in reply to Re: exec()ed process dont write to std(?:err|out)
in thread exec()ed process dont write to std(?:err|out)

Gah. Thank you. I totally missed that.

But this still doesnt clarify in my mind why it returns immediately. For instance check this output:

D:\Development>type test.pl print "hello world!\n"; #sleep(999999); D:\Development>perl -I. -MNameExe test.pl && echo boo boo D:\Development>hello world! [cursor blinks here]

Is this what I should have expected?! (Update: I mean should the echo statement complete before the newly spawned perl process? I would expect the output to be reversed.)


---
demerphq

    First they ignore you, then they laugh at you, then they fight you, then you win.
    -- Gandhi


Replies are listed 'Best First'.
Re: Re: Re: exec()ed process dont write to std(?:err|out)
by PodMaster (Abbot) on Apr 13, 2004 at 11:44 UTC
    Now that I think about it, I'd it's all about timing. Consider
    perl -e"exec $^X,qw[ -e sleep(1);warn(666)];die 55" && echo BOO perl -e'exec $^X,qw[ -e sleep(1);warn(666)];die 55' && echo BOO
    and vary the sleep duration (0 and up). On Win2000 I get
    E:\>perl -e"exec $^X,qw[ -e sleep(0);warn(666)];die 55" && echo BOO 666 at -e line 1. BOO E:\>perl -e"exec $^X,qw[ -e sleep(1);warn(666)];die 55" && echo BOO BOO E:\>666 at -e line 1.
    and on debian with bash I get
    crazyinsomniac@perlmonk:~$ perl -e'exec $^X,qw[ -e sleep(1);warn(666)] +;die 55' && echo BOO 666 at -e line 1. BOO
    regardless of the sleep duration (the sleep just delays the output). The bash might be fixing the results with some kind of buffering but I can't tell.

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.