jilles fafc9ed682 Do not fork for a subshell if it is the last thing this shell is doing
(EV_EXIT). The fork is still done as normal if any traps are active.

In many cases, the fork can be avoided even without this change by using {}
instead of (), but in practice many scripts use (), likely because the
syntax is simpler.

Example:
  sh -c '(/bin/sleep 10)& sleep 1;ps -p $! -o comm='
Now prints "sleep" instead of "sh". $! is more useful this way.
Most shells (dash, bash, pdksh, ksh93, zsh) seem to print "sleep" for this.

Example:
  sh -c '( ( ( (ps jT))))'
Now shows no waiting shell processes instead of four.
Most shells (dash, bash, pdksh, ksh93, zsh) seem to show zero or one.

PR:		bin/74404
Approved by:	ed (mentor) (implicit)
2009-06-23 21:50:06 +00:00
..
2009-01-30 16:23:57 +00:00
2006-12-18 15:45:01 +00:00
2007-03-04 19:52:07 +00:00
2007-03-04 09:15:12 +00:00
2009-04-13 15:29:14 +00:00
2006-12-27 11:28:00 +00:00
2006-12-27 12:14:56 +00:00
2005-08-07 09:11:38 +00:00