"Williams, Ivor" <[EMAIL PROTECTED]> writes:
>
> I'm curious to know what happens in the following circumstances:
>
> open PROG,"run myprog.exe|" or die "Failed to spawn\n$!\nstopped";
...
> Suppose myprog.exe bombs out with a fatal error. The message presumably goes
> into the pipe and is fed to the <PROG> filehandle. However, it would be
> incredibly useful to also capture this information in a file. The normal way
> to achieve this is to redirect SYS$ERROR. I can achieve this by putting a
> DCL wrapper round the program (ugh!).
>
> I was just wondering if there was some syntax that would let perl's open do
> this for me.
>
> I was also wondering what actually happens to SYS$ERROR here. Does it go to
> NL:? Does it also go down the same pipe?
Old piping scheme: the subprocess's SYS$ERROR is set to the the same
device as its SYS$OUTPUT, i.e., they both use the same pipe into the
PROG filehandle.
New piping scheme (patches posted over the past month): the subprocess's
SYS$ERROR is directed to where the main process is sending STDERR
when the PROG filehandle is opened (defaults to main process SYS$ERROR
unless redirected on command line or via open commands).
So if you (new scheme):
open(STDERR,">errors.lis");
open(PROG,"run myprog.exe|") or die "Failed to spawn\n$!\nstopped";
Then myprog.exe's SYS$ERROR output will show up in errors.lis.
--
Drexel University \V --Chuck Lane
----------------->--------*------------<[EMAIL PROTECTED]
(215) 895-1545 / \ Particle Physics [EMAIL PROTECTED]
FAX: (215) 895-5934 /~~~~~~~~~~~ [EMAIL PROTECTED]