in reply to When starting a process, at what point does "open()" return?
On UNIX systems, open("...|") works similar to the C function popen(). It returns after calling fork(). There is no guarantee that the process can actually be loaded.
On WIN32 systems, open("...|") creates a new process using CreateProcess(). CreateProcess() will fail immediately if the process cannot be initiated, therefore open() will fail as well. Portable code should not rely on this behaviour.
UPDATE: Perl does have some magic implemented for most UNIX platforms that attempts to pass the error code from child process to parent before open() returns. This should catch most cases involving permissions or the executable not existing.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: When starting a process, at what point does "open()" return?
by esh (Pilgrim) on Aug 18, 2003 at 06:03 UTC | |
by MarkM (Curate) on Aug 18, 2003 at 16:11 UTC | |
by Anonymous Monk on Aug 18, 2003 at 19:50 UTC |
In Section
Seekers of Perl Wisdom