Skip to content

Commit

Permalink
Add --kill flag
Browse files Browse the repository at this point in the history
  • Loading branch information
rqdmap committed May 4, 2023
1 parent 3b2e036 commit bf34518
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/giph
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,21 @@ function handle_usr1(){
# Ensure giph only receives SIGUSR1 ONCE
if [[ -n $FFMPEG_PID && "$signal_usr1_handled" == false ]]; then
signal_usr1_handled=true
kill $FFMPEG_PID
kill $FFMPEG_PID
wait $FFMPEG_PID
fi
}

function handle_usr2(){
if [[ -n $FFMPEG_PID ]]; then
kill -KILL $FFMPEG_PID
fi
delete_temporary_directory
exit 1
}

trap handle_usr1 SIGUSR1
trap handle_usr2 SIGUSR2

readonly VERSION=1.1.1

Expand Down Expand Up @@ -493,9 +502,10 @@ function stop_all_recordings() {
}
# Todo
function abort_all_recordings() {
:
for pid in $(pgrep -f "bash.+giph"); do
kill -USR2 -$pid
done
}
if [ -n "$SHOULD_STOP" ]; then
Expand Down

0 comments on commit bf34518

Please sign in to comment.