Thread (6 messages) flat view 6 messages, 2 authors, 2016-08-11

Re: Easy shell question: how to make a script killing all his childs when killed?

From: Marco Costalba <hidden>
Date: 2016-08-11 20:31:00

On 12/9/06, Alex Riesen [off-list ref] wrote:
Marco Costalba, Sat, Dec 09, 2006 16:16:32 +0100:
quoted
P.S: I have no way to exec the script in fancy ways, I can just start
it and get is PID.
Which is "fancy" enough. What do you mean "start"? Starting a new
process usually and notably involves forking and execing (even if the
first thing to exec will be your shell).
By 'start' I mean it is done inside Qt QProcess class back box ;-)

Anyway I have written an homegrown 'wanna be hacker' launching script:

git rev-list --header --boundary --parents --topo-order HEAD >
/tmp/qgit_136224752.txt &
echo $!
wait


With this I can get the pid of git-rev-list from my QProcess interface
so to be able to kill it when needed with another command ('kill'
BTW).

I have googled around and it seems that 'echo $!' and 'wait' _should_
be portable among many shell, please correct me if'm wrong or if the
approach is failing (I already know it's ugly ;-)  )
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help