Jeff Abrahamson on 7 Jan 2004 20:11:10 -0000


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

process in the background


According to perlipc, this should work:

    perl -e '$x=`(sleep 2;hostname)&`;print $x;'

That is, it should print nothing and terminate.

In fact, it takes two seconds before perl prints my hostname and
terminates.

Maybe perl is waiting on its children before terminating or cares that
I am looking at the command's stdout.  But I don't think so:

    perl -e '`(sleep 2;hostname) &`;print "0\n";sleep 1;print "1\n";sleep 1;print "2\n";'

waits two seconds before it prints 0, 1, 2 separated by a second each.


Any ideas what's going on here?

Of course, I can use fork directly...

-- 
 Jeff

 Jeff Abrahamson  <http://www.purple.com/jeff/>
 GPG fingerprint: 1A1A BA95 D082 A558 A276  63C6 16BF 8C4C 0D1D AE4B
-
**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**