perlfaq nodetype
faq_monk
<P>
It does, but probably not how you expect it to. On systems that follow the standard
<CODE>fork()/exec()</CODE> paradigm (such as Unix), it works like this:
<CODE>open()</CODE> causes a
<CODE>fork().</CODE> In the parent,
<CODE>open()</CODE> returns with the process
<FONT SIZE=-1>ID</FONT> of the child. The child
<CODE>exec()s</CODE> the command to be piped to/from. The parent can't know whether the
<CODE>exec()</CODE> was successful or not - all it can return is whether the
<CODE>fork()</CODE> succeeded or not. To find out if the command succeeded, you have to catch
<FONT SIZE=-1>SIGCHLD</FONT> and
<CODE>wait()</CODE> to get the exit status. You should also catch
<FONT SIZE=-1>SIGPIPE</FONT> if you're writing to the child -- you may not have found out the
<CODE>exec()</CODE> failed by the time you write. This is documented in
[perlman:perlipc|the perlipc manpage].
<P>
On systems that follow the
<CODE>spawn()</CODE> paradigm,
<CODE>open()</CODE>
<EM>might</EM> do what you expect - unless perl uses a shell to start your command. In this case the
<CODE>fork()/exec()</CODE> description still applies.
<P>