darcs patch: spawnDescendantOn

Tue Sep 1 00:42:18 EDT 2009 Daniel Wagner

* On Tuesday, September 01 2009, wagnerdm@seas.upenn.edu wrote:
Tue Sep 1 00:42:18 EDT 2009 Daniel Wagner
* add spawnOn-alikes that watch for child processes spawnOn is insufficient because many programs are simply shell scripts wrapping the real application. This adds some functions that watch for child processes, which treats these scripts properly. Notably, launchers like dmenu are dealt with this way.
I think most of the time people would prefer spawnDescendantOn to spawnOn. Perhaps the shorter names should go to the new child finding versions? -- Adam

On Tue, Sep 01, 2009 at 12:59:30AM -0400, wagnerdm@seas.upenn.edu wrote:
Tue Sep 1 00:42:18 EDT 2009 Daniel Wagner
* add spawnOn-alikes that watch for child processes spawnOn is insufficient because many programs are simply shell scripts wrapping the real application. This adds some functions that watch for child processes, which treats these scripts properly. Notably, launchers like dmenu are dealt with this way.
Tue Sep 1 00:42:18 EDT 2009 Daniel Wagner
* add spawnOn-alikes that watch for child processes spawnOn is insufficient because many programs are simply shell scripts wrapping the real application. This adds some functions that watch for child processes, which treats these scripts properly. Notably, launchers like dmenu are dealt with this way.
I'd like some time to review this before anyone else applies it. I notice some use of /proc, that will fail under non-Linux, right? Also, can we mostly avoid the need for all this by 'exec'ing scripts? Cheers, Spencer Janssen

On Sep 2, 2009, at 22:22 , Spencer Janssen wrote:
On Tue, Sep 01, 2009 at 12:59:30AM -0400, wagnerdm@seas.upenn.edu wrote: I'd like some time to review this before anyone else applies it.
I notice some use of /proc, that will fail under non-Linux, right?
Also, can we mostly avoid the need for all this by 'exec'ing scripts?
If it's careful, it can also work on FreeBSD and possibly even Solaris. Depends on what it's doing. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

On Sep 2, 2009, at 22:24 , Brandon S. Allbery KF8NH wrote:
On Sep 2, 2009, at 22:22 , Spencer Janssen wrote:
On Tue, Sep 01, 2009 at 12:59:30AM -0400, wagnerdm@seas.upenn.edu wrote: I notice some use of /proc, that will fail under non-Linux, right?
If it's careful, it can also work on FreeBSD and possibly even Solaris. Depends on what it's doing.
Also, if it's using /proc to wait for child processes, it could spawn pwait on all three (this might require an extra dependency though, as I think only Solaris installs it by default). -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

Quoting Spencer Janssen
I notice some use of /proc, that will fail under non-Linux, right?
Maybe. I based the implementation on the information here: http://www.steve.org.uk/Reference/Unix/faq_2.html#SEC17 which suggests that parsing /proc is the cleanest way when it works. If someone on a BSD could give a sample /proc/PID/status file, that would of course help.
Also, can we mostly avoid the need for all this by 'exec'ing scripts?
Some of it can be avoided this way, yes, and I believe that's what spawnOn attempts to do, in a somewhat hacky way. ~d

spencerjanssen:
On Tue, Sep 01, 2009 at 12:59:30AM -0400, wagnerdm@seas.upenn.edu wrote:
Tue Sep 1 00:42:18 EDT 2009 Daniel Wagner
* add spawnOn-alikes that watch for child processes spawnOn is insufficient because many programs are simply shell scripts wrapping the real application. This adds some functions that watch for child processes, which treats these scripts properly. Notably, launchers like dmenu are dealt with this way.
Tue Sep 1 00:42:18 EDT 2009 Daniel Wagner
* add spawnOn-alikes that watch for child processes spawnOn is insufficient because many programs are simply shell scripts wrapping the real application. This adds some functions that watch for child processes, which treats these scripts properly. Notably, launchers like dmenu are dealt with this way.
I'd like some time to review this before anyone else applies it.
I notice some use of /proc, that will fail under non-Linux, right?
Also, can we mostly avoid the need for all this by 'exec'ing scripts?
/proc is non-portable

On Thu, Sep 3, 2009 at 2:40 AM, Don Stewart
spencerjanssen:
On Tue, Sep 01, 2009 at 12:59:30AM -0400, wagnerdm@seas.upenn.edu wrote:
Tue Sep 1 00:42:18 EDT 2009 Daniel Wagner
* add spawnOn-alikes that watch for child processes spawnOn is insufficient because many programs are simply shell scripts wrapping the real application. This adds some functions that watch for child processes, which treats these scripts properly. Notably, launchers like dmenu are dealt with this way.
Tue Sep 1 00:42:18 EDT 2009 Daniel Wagner
* add spawnOn-alikes that watch for child processes spawnOn is insufficient because many programs are simply shell scripts wrapping the real application. This adds some functions that watch for child processes, which treats these scripts properly. Notably, launchers like dmenu are dealt with this way.
I'd like some time to review this before anyone else applies it.
I notice some use of /proc, that will fail under non-Linux, right?
Also, can we mostly avoid the need for all this by 'exec'ing scripts?
/proc is non-portable
Is this the final verdict? Then I've marked it 'rejected' on darcswatch: http://darcswatch.nomeata.de/repo_http:__code.haskell.org_XMonadContrib.html -- gwern
participants (6)
-
Adam Vogt
-
Brandon S. Allbery KF8NH
-
Don Stewart
-
Gwern Branwen
-
Spencer Janssen
-
wagnerdm@seas.upenn.edu