Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Apr 2009 13:40:03 GMT
From:      Jilles Tjoelker <jilles@stack.nl>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/74404: sh(1) does not handle signals to subshells properly and/or $! is broken
Message-ID:  <200904051340.n35De3Mm079270@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/74404; it has been noted by GNATS.

From: Jilles Tjoelker <jilles@stack.nl>
To: bug-followup@FreeBSD.org, silby@silby.com
Cc:  
Subject: Re: bin/74404: sh(1) does not handle signals to subshells properly
	and/or $! is broken
Date: Sun, 5 Apr 2009 15:36:04 +0200

 > [ sh forks twice for (somecommand) & ]
 
 It seems reasonable for sh to fork twice here. You can avoid it by doing
 { somecommand; } &.
 
 If I force bash (4.0.10) to fork twice (using  { ( sleep 900; echo a );
 echo b; }  ), it "breaks" the same way as sh does in your example. It
 does not "pass on" signals. If you want to pass on signals, do it
 manually using the trap builtin.
 
 It would be possible fairly easily to make sh treat (CMD)& as { CMD; }&
 but I'm not sure if it's worth it.
 
 -- 
 Jilles Tjoelker



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904051340.n35De3Mm079270>