git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Alex Riesen <fork0@t-online.de>
Date
Dec 10, 2006, 14:25 UTC
Message-ID
<20061210142558.GA4836@steel.home>
In-Reply-To
<e5bfff550612091506g41e40e87n6356b8ddd5e16a5d@mail.gmail.com>
Marco Costalba, Sun, Dec 10, 2006 00:06:34 +0100:
Show 17 quoted lines
> On 12/9/06, Alex Riesen <fork0@t-online.de> wrote:
> >
> >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)
> >
> 
> Well, I _used_ QProcess interface until last week. It's socket based
> and it's quite fast (much more then gitk BTW), but due to some
> internal buffering not so fast as reading from a file (in my last post
> regarding git-rev-list access there are some performance numbers to
> document this). It seems that socket/pipe based IPC is not as fast as
> file write/read. Of course we are talking of OS cached files, no disk
> access must be involved to keep the speed.
Oh, I see now ("Fast access git-rev-list output...").
BTW, I just cannot reproduce that at all (on Linux):
    time { git rev-list --all > /tmp/ggg; cat /tmp/ggg >/dev/null; }
tends to be somewhat slower than
    time git rev-list --all | cat >/dev/null
QProcess must be doing something stupid.
> Regarding gitk we are at least one order of magnitude faster both with
> QProcess and, more, with temporary files, so it's not a useful
> reference in this case.

Dunno. It's hard to assess on "small" repos, like kernel. They feel almost equally fast (maybe because qgit checks working directory too). Haven't tried QGit on Windows yet (does it work there?).

> P.S: I didn't experiment with popen(). Thanks for the hint, I will
> give it a try ;-)

popen(3) usually uses pipe(2). It's also awkward with regard to shell metacharacters and signals (as system(3) is). You can use your' own buffers (setvbuf) so that could be a win against QProcess.

Previous: Marco Costalba
Message 6 of 6 in “Easy shell question: how to make a script killing all his childs when killed?”
  1. Marco CostalbaDec 9, 2006
  2. Alex RiesenDec 9, 2006
  3. Marco CostalbaDec 9, 2006
  4. Alex RiesenDec 9, 2006
  5. Marco CostalbaDec 9, 2006
  6. Alex RiesenDec 10, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.