From 3cb06f9a81adaa4fe75214f9d80c0fa08d226a93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20D=C3=A9saulniers?= Date: Sat, 4 Nov 2017 21:35:04 -0400 Subject: [PATCH] userscripts/cast: effectively kill old proc Custom location installed castnow can't be killed with the command `pkill -f /usr/bin/castnow`. Now recover the path to the binary in the path for calling and killing the program. --- misc/userscripts/cast | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/misc/userscripts/cast b/misc/userscripts/cast index fd1bab4d5..da68297d8 100755 --- a/misc/userscripts/cast +++ b/misc/userscripts/cast @@ -133,9 +133,15 @@ echo "jseval -q $(printjs)" >> "$QUTE_FIFO" tmpdir=$(mktemp -d) file_to_cast=${tmpdir}/qutecast +program_=$(command -v castnow) + +if [[ "${program_}" == "" ]]; then + msg error "castnow can't be found..." + exit 1 +fi # kill any running instance of castnow -pkill -f /usr/bin/castnow +pkill -f "${program_}" # start youtube download in stream mode (-o -) into temporary file youtube-dl -qo - "$1" > ${file_to_cast} & @@ -143,7 +149,7 @@ ytdl_pid=$! msg info "Casting $1" >> "$QUTE_FIFO" # start castnow in stream mode to cast on ChromeCast -tail -F "${file_to_cast}" | castnow - +tail -F "${file_to_cast}" | ${program_} - # cleanup remaining background process and file on disk kill ${ytdl_pid}