Capturing screen output [message #28088] |
Tue, 20 November 2001 12:27  |
David Shadovitz
Messages: 19 Registered: September 2000
|
Junior Member |
|
|
I'm running IDL 5.4 on a Sun.
I've got a file, cpsub1, which looks like this:
$ cat cpsub1
echo "computePPP, /batch, inputfile='abc.hdf'" | idl
If I run it by simply typing cpsub1 at the command line, all of the IDL
messages and PRINT statement outputs are sent to the screen:
$ cpsub1
% Compiled module: MODULE1
% Compiled module: MODULE2
% Compiled module: MODULE3
Entered main routine...
Computing the power...
Done.
$
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
$ cpsub2
% Compiled module: MODULE1
% Compiled module: MODULE2
% Compiled module: MODULE3
$
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.
Can anyone help me capture the IDL messages and the PRINT statement
output into a file? I'm running my code in this odd manner because
ultimately I want to run the job in batch mode via 'ssub'.
Thanks.
-David Shadovitz
|
|
|
Re: Capturing screen output [message #28194 is a reply to message #28088] |
Tue, 27 November 2001 01:13   |
Heike Koch-Beuttenmue
Messages: 6 Registered: October 1999
|
Junior Member |
|
|
David Shadovitz wrote:
>
> 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.
>
> Thanks.
> -David
>
> "Liam E. Gumley" wrote:
>
>> Your example works fine for me in Solaris 7 with IDL 5.3:
>>
>> $ cat runidl
>> print, 'Hello world'
>> exit
>>
>> $ idl runidl
>> IDL Version 5.3 (sunos sparc). (c) 1999, Research Systems, Inc.
>>
>> Hello world
>>
>> $ idl runidl > runidl.out
>> IDL Version 5.3 (sunos sparc). (c) 1999, Research Systems, Inc.
>>
>> $ cat runidl.out
>> Hello world
>>
>> This might be a platform specific bug in IDL 5.4 on Solaris. You might
>> want to check with RSI tech support.
I tried it with IDL 5.4 both under Solaris 2.8 and 2.9 beta and got the
same effect. pvwave 7.5 works. So I think it is an IDL problem. I did
not try the solution of Ken because I think it must be done easier.
Heike
|
|
|
Re: Capturing screen output [message #28213 is a reply to message #28088] |
Mon, 26 November 2001 12:39   |
David Shadovitz
Messages: 19 Registered: September 2000
|
Junior Member |
|
|
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.
Thanks.
-David
"Liam E. Gumley" wrote:
> Your example works fine for me in Solaris 7 with IDL 5.3:
>
> $ cat runidl
> print, 'Hello world'
> exit
>
> $ idl runidl
> IDL Version 5.3 (sunos sparc). (c) 1999, Research Systems, Inc.
>
> Hello world
>
> $ idl runidl > runidl.out
> IDL Version 5.3 (sunos sparc). (c) 1999, Research Systems, Inc.
>
> $ cat runidl.out
> Hello world
>
> This might be a platform specific bug in IDL 5.4 on Solaris. You might
> want to check with RSI tech support.
|
|
|
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
|
|
|