Re: Capturing screen output (stdout/stderr redirect problem) [message #28302 is a reply to message #28194] |
Thu, 29 November 2001 02:05   |
Gary Swift
Messages: 2 Registered: November 2001
|
Junior Member |
|
|
> David Shadovitz wrote:
> I'd like to capture that information in a log file, so I tried
> redirecting standard output, like this:
>
> $ cat cpsub2
> echo "computePPP, /batch, inputfile='abc.hdf'" | idl > cplog2
>
> [snip]
>
> As you can see, now only the IDL messages are written to the screen.
> But the PRINT statement outputs aren't sent to the log file! Upon
> completion, cplog2 is a 0-byte file.
>
> Then I tried redirecting both standard output and standard error:
>
> $ cat cpsub3
> echo "computePPP, /batch, inputfile='abc.hdf'" | idl > cplog3 2>&1
> $ cpsub3
> $
>
> Now nothing is written to the screen. But neither is it going to the
> log file! Upon completion, cplog3 is a 0-byte file.
...
>>
>> Wow! I ran the same test under IDL 5.2.1 on the same machine, and it worked! So I
>> wonder whether it is an IDL 5.4 bug, as you suggest, or whether our admins somehow
>> blew it on the installation. I'll start a new thread, asking other Solaris / IDL
>> 5.4 users to try this out.
There is a bug in IDL 5.4 for Solaris (on SPARC only, not x86 I think)
with redirecting stdout or stderr. RSI says it's been fixed in 5.5. The
workaround is to do a
flush, -1
and/or
flush, -2
whenever you care about the output. I suspect this is your problem. We've
been adding the flushes routinely at the end of our event managers, just in
case, especially if something does a spawn of a UNIX command.
Hope that solves your problem.
-- Gary Swift
----
Design MatriX
http://www.designmatrix.com
Email: gary @designmatrix.com
Phone: 310 455 3107
IDL services: http://www.designmatrix.com/services/IDL.html
|
|
|