fix: recording process didn't quit

This commit is contained in:
Klesh Wong 2022-07-25 11:43:55 +08:00
parent e82837ed1d
commit 9559c3471f

7
bin/sc
View File

@ -7,8 +7,9 @@ function _stop
killall screenkey 2>/dev/null killall screenkey 2>/dev/null
if test -f /tmp/recording.pid if test -f /tmp/recording.pid
read recpid < /tmp/recording.pid read recpid < /tmp/recording.pid
pkill --signal 15 -g $recpid kill -SIGTERM $recpid;
rm /tmp/recording.pid # pkill --signal 15 -g $recpid
and rm /tmp/recording.pid
end end
end end
@ -25,7 +26,7 @@ function _start -a x y w h fps
-f alsa -i default \ -f alsa -i default \
-r $fps -c:v h264 -crf 0 -preset ultrafast \ -r $fps -c:v h264 -crf 0 -preset ultrafast \
-c:a aac \ -c:a aac \
$outfile & $outfile > /dev/null 2>&1 </dev/null &
echo $last_pid > /tmp/recording.pid echo $last_pid > /tmp/recording.pid
echo $outfile echo $outfile
end end