Curious problem when Output is redirected...

From: Michael Uddstrom <m.uddstrom_at_nyahnyahspammersnyahnyah>
Date: Mon, 01 Oct 2007 17:18:39 +1200

Greetings...

We are wondering if the following is expected?

Using NCL 4.3.0 on Red Hat Enterprise Linux 5

The Systemfunc returns "rubbish" when the invoked system call fails IF
output redirection is used (and, therefore, in batch queue jobs!).
Here's a minimal test script that calls /bin/false, a program that "does
nothing, unsuccessfully".:

;------- test.ncl ----------------------
print( systemfunc( "/bin/false" ))
;----------------------------------------

Running this directly from the command line produces, as expected:

*$ ncl test.ncl*
Copyright (C) 1995-2007 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 4.3.0
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.

(0) -999

But redirecting stdout to file, we get:

*$ ncl test.ncl > test.out*

*$ cat test.out*
Copyright (C) 1995-2007 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 4.3.0
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.

(0) Copyright (C) 1995-2007 - All Rights Reserved
(1) University Corporation for Atmospheric Research
(2) NCAR Command Language Version 4.3.0
(3) The use of this software is governed by a License Agreement.
(4) See http://www.ncl.ucar.edu/ for more details.

In fact, it appears that all previous stdout is returned by systemfunc
whenever the invoked system command fails.

Thanks for your help.

Regards

Michael

-- 
Dr. Michael J. Uddstrom
Science Leader: Environmental Forecasting
Principal Scientist: Meteorology and Remote Sensing
National Institute of Water and Atmospheric Research
Private Bag 14-901, Wellington, New Zealand
DDI: +64 4 386 0365, 	Fax: +64 4 386 2153,
Home: +64 4 478 9734
http://www.niwa.co.nz/


_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Sun Sep 30 2007 - 23:18:39 MDT

This archive was generated by hypermail 2.2.0 : Thu Oct 04 2007 - 08:54:08 MDT