Re: IDL> bug in SPAWN [message #3854] |
Mon, 10 April 1995 00:00 |
Fergus Gallagher
Messages: 41 Registered: January 1995
|
Member |
|
|
Serdar Manizade <manizade@aol3.wff.nasa.gov> wrote:
> I have seen behavior from SPAWN that may or may not have anything
> to do with your problem. (I am now running IDL3.6.1a under Solaris2.3)
> I was doing something like:
> SPAWN,'ls *.dat', filelist
> print,filelist
> This would look fine on the screen, but then I would try:
> openr,lun,/get,filelist(0)
> and I would get a message saying file not found. A clue to the
> problem was revealed by:
> print,strlen(filelist)
> filelist(0) was much longer than any of filelist(1:*). The problem
> was due to the initialization of my shell that was created by SPAWN.
> The quick solution (which is what I implemented) is to intercept the
> undesired characters thus:
> SPAWN,'date ; ls *.dat',filelist
> filelist=filelist(1:*)
>
> For other applications where I did not need the shell (for example
> when I did not have any wildcards in my command), then SPAWN,/noshell
> would also work.
>
> Fergus Gallagher <F.Gallagher@nerc.ac.uk> wrote:
>>
>> I am using IDL 3.6.1 under solaris 2.3. When I try
>>
>> IDL> spawn,command,out
>> IDL> print,'*'+out
>>
>> then the FIRST line of 'out' has the '*' missing. Closer inspection
>> shows that there is an extra character 13 at the start of out(0).
>>
>> This does *not* occur using the same version of IDL under SunOs 4.1.3.
>>
>> Can anyone report the same effect under any other operating system?
>>
>> It is not clear to me whether the bug is in the OS or in IDL.
>>
I think you've hit the nail on the head.
When I try
ls | wc
I get one byte fewer than
csh -c ls | wc
This is under Solaris 2.3 and 2.4. Under SunOS 4.1.3, they both give the
same result. ( I checked that 'source .cshrc | wc' gave a zero result on
all platforms, since our .cshrc are OS dependent)
So, to answer my own original question, the bug appears to be in the OS,
not IDL. Serdar's fix would seem to be a wise one for any applications
developers to adopt, viz
spawn,'date;...',out
out = out(1:*)
which absorbs any erroneous characters into the output from date.
Fergus
CC: Floating Point Systems
=================================================
| Fergus Gallagher |
| Remote Sensing Applications Development Unit |
| British National Space Centre |
| Monks Wood |
| Huntingdon PE17 2LS / UK |
| |
| F.Gallagher@nerc.ac.uk |
| http://uh.nmt.ac.uk/bnsc/fgg.html |
=================================================
|
|
|
Re: IDL> bug in SPAWN [message #3907 is a reply to message #3854] |
Wed, 29 March 1995 00:00  |
Serdar Manizade
Messages: 15 Registered: December 1994
|
Junior Member |
|
|
I have seen behavior from SPAWN that may or may not have anything
to do with your problem. (I am now running IDL3.6.1a under Solaris2.3)
I was doing something like:
SPAWN,'ls *.dat', filelist
print,filelist
This would look fine on the screen, but then I would try:
openr,lun,/get,filelist(0)
and I would get a message saying file not found. A clue to the
problem was revealed by:
print,strlen(filelist)
filelist(0) was much longer than any of filelist(1:*). The problem
was due to the initialization of my shell that was created by SPAWN.
I had some non-printing characters that were used to set the
title of my X window etc. and these were being returned as the
start of the result returned to SPAWN in the variable filelist.
The proper solution would have been to make my shell start-up smart
enough to recognize that it was not running in an X window. The
quick solution (which is what I implemented) is to intercept the
undesired characters thus:
SPAWN,'date ; ls *.dat',filelist
filelist=filelist(1:*)
For other applications where I did not need the shell (for example
when I did not have any wildcards in my command), then SPAWN,/noshell
would also work.
I first experienced the problem after upgrading the OS and/or the
version of IDL, but I have forgotten the specifics-- it was over a
year ago.
good luck,
Serdar Manizade
NASA Wallops Flight Facility, Wallops Island VA, USA
Fergus Gallagher <F.Gallagher@nerc.ac.uk> wrote:
>
> I am using IDL 3.6.1 under solaris 2.3. When I try
>
> IDL> spawn,command,out
> IDL> print,'*'+out
>
> then the FIRST line of 'out' has the '*' missing. Closer inspection
> shows that there is an extra character 13 at the start of out(0).
>
> This does *not* occur using the same version of IDL under SunOs 4.1.3.
>
> Can anyone report the same effect under any other operating system?
>
> It is not clear to me whether the bug is in the OS or in IDL.
>
> Fergus
>
> CC: FPS IDL tech support
> Bill Thompson, GSFC
>
> =================================================
> | Fergus Gallagher |
> | Remote Sensing Applications Development Unit |
> | British National Space Centre |
> | Monks Wood |
> | Huntingdon PE17 2LS / UK |
> | |
> | F.Gallagher@nerc.ac.uk |
> | http://uh.nmt.ac.uk/bnsc/fgg.html |
> =================================================
>
>
|
|
|
Re: IDL> bug in SPAWN [message #3916 is a reply to message #3907] |
Mon, 27 March 1995 16:49  |
pellet
Messages: 12 Registered: October 1994
|
Junior Member |
|
|
Fergus Gallagher (F.Gallagher@nerc.ac.uk) wrote:
: I am using IDL 3.6.1 under solaris 2.3. When I try
:
: IDL> spawn,command,out
: IDL> print,'*'+out
:
: then the FIRST line of 'out' has the '*' missing. Closer inspection
: shows that there is an extra character 13 at the start of out(0).
:
: This does *not* occur using the same version of IDL under SunOs 4.1.3.
:
: Can anyone report the same effect under any other operating system?
:
: It is not clear to me whether the bug is in the OS or in IDL.
:
: Fergus
:
It works ok on my machine. I'm using IDL 3.6 under AIX 3.2.5.
Jeff
pellet@inrs-ener.uquebec.ca
|
|
|