Skip to content

Commit bf34518

Browse files
committed
Add --kill flag
1 parent 3b2e036 commit bf34518

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/giph

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,21 @@ function handle_usr1(){
77
# Ensure giph only receives SIGUSR1 ONCE
88
if [[ -n $FFMPEG_PID && "$signal_usr1_handled" == false ]]; then
99
signal_usr1_handled=true
10-
kill $FFMPEG_PID
10+
kill $FFMPEG_PID
1111
wait $FFMPEG_PID
1212
fi
1313
}
1414

15+
function handle_usr2(){
16+
if [[ -n $FFMPEG_PID ]]; then
17+
kill -KILL $FFMPEG_PID
18+
fi
19+
delete_temporary_directory
20+
exit 1
21+
}
22+
1523
trap handle_usr1 SIGUSR1
24+
trap handle_usr2 SIGUSR2
1625

1726
readonly VERSION=1.1.1
1827

@@ -493,9 +502,10 @@ function stop_all_recordings() {
493502
}
494503
495504
496-
# Todo
497505
function abort_all_recordings() {
498-
:
506+
for pid in $(pgrep -f "bash.+giph"); do
507+
kill -USR2 -$pid
508+
done
499509
}
500510
501511
if [ -n "$SHOULD_STOP" ]; then

0 commit comments

Comments
 (0)