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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Marco Costalba, Sat, Dec 09, 2006 18:51:57 +0100:
> >> 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).

Why do you need to save it in temporary file at all? Why don't you
read the output like gitk does?  You can take a look at popen(3). It's
known to be portable among operating systems and libc's.  Or, BTW, why
don't you just read qprocess.h, use processIdentifier()/pid(),
read*()-methods and the like?  (though, looking at the QProcess in
qt3, I wouldn't really blame you)
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]