Skip to content

Commit 7c4c80e

Browse files
Fix: Fully wait for wf-recorder before continuing (#41)
* fix: Wait for all wf-recorder subprocesses * fix(record_start): Record exit code of wait Used to record the exit code of the debub Print statement * fix(record_start): Handle return code 130 (SIGINT)
1 parent cfcc12e commit 7c4c80e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

hyprcap

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,19 @@ function record_start() {
199199
# operations (notifications, saving, etc.)
200200
Print -1 "Waiting for process $rec_pid to finish...\n"
201201
wait "$rec_pid"
202-
Print -1 "Process $rec_pid finished.\n"
203202
local exit_code=$?
203+
Print -1 "Process $rec_pid finished with code $exit_code.\n"
204+
205+
# Wait for al subprocesses to finish too, otherwise we may find
206+
# incomplete files.
207+
wait
204208

205209
# Once wf-recorder exits, we can remove the PID file
206210
rm "$REC_PID_PATH" 2>/dev/null
207-
# And return the exit code from the recording command
208-
return $exit_code
211+
# And return the exit code from the recording command unless it's
212+
# 130 (SIGINT), which is expected.
213+
[ $exit_code -eq 130 ] || return $exit_code
214+
# Default return code is 0 otherwise
209215
}
210216

211217
function record_stop() {

0 commit comments

Comments
 (0)