Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^3: Variable triggers global destruction hangby ikegami (Patriarch) |
on Sep 12, 2009 at 06:44 UTC ( [id://794896]=note: print w/replies, xml ) | Need Help?? |
Neither of those hang for me. (5.8.8 on linux) Update: I just figured out why it hangs in 5.10+. Closing the Perl handle will cause perl to close the system handle and wait for cat to end. Without duping: Since the pipe is closed on Perl's side, it gets closed on cat's side and cat exits. perl's wait is short. With duping and STDOUT gets closed after FH: Since the pipe is still open on Perl's side because of the dup, it doesn't gets closed on cat's side and cat doesn't exit. perl's wait is "infinite". With duping and STDOUT gets closed before FH: It's like there was no duping. (The order in which stuff gets freed during global destruction is undefined and/or unpredictable.)
In Section
Seekers of Perl Wisdom
|
|