SPAWN exit status different from shell exit status. [message #88872] |
Mon, 30 June 2014 07:04  |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Hello,
I'm trying to run a compiled executable within IDL.
When I run the exe in a regular shell I get the following:
$ myexe
Program received signal SIGSEGV: Segmentation fault - invalid memory
reference.
Backtrace for this error:
#0 0x7FD97E7ADA77
#1 0x7FD97E7AE07E
#2 0x3000C3299F
#3 0x45EBBB in sub1_
#4 0x47688D in sub2_
#5 0x409A9F in sub3_
#6 0x42BABA in MAIN__ at myprog.f90:0
Segmentation fault (core dumped)
If I inspect the exit value I see:
$ echo $?
139
Now, if I do the same thing inside an IDL SPAWN command I get the following:
IDL> SPAWN, 'myexe', stdout, stderr, EXIT_STATUS = exit_stat
IDL> print, exit_stat
0
IDL> help, stderr
STDERR STRING = Array[11]
IDL> print, stderr, format='(a)'
Program received signal SIGSEGV: Segmentation fault - invalid memory
reference.
Backtrace for this error:
#0 0x7F39A545DA77
#1 0x7F39A545E07E
#2 0x3000C3299F
#3 0x45EBBB in sub1_
#4 0x47688D in sub2_
#5 0x409A9F in sub3_
#6 0x42BABA in MAIN__ at myprog.f90:0
So it's still failing but the exit_status is always 0 (i.e. successful)
I've tried the command with /SH and /NOSHELL and get the same result.
Does anyone have any idea why SPAWN is not setting the EXIT_STATUS
correctly?
cheers,
paulv
p.s.
IDL> print, !VERSION
{ x86_64 linux unix linux 8.3 Nov 15 2013 64 64}
|
|
|
Re: SPAWN exit status different from shell exit status. [message #88876 is a reply to message #88872] |
Mon, 30 June 2014 09:31   |
lecacheux.alain
Messages: 325 Registered: January 2008
|
Senior Member |
|
|
On Monday, June 30, 2014 4:04:52 PM UTC+2, Paul van Delst wrote:
> Hello,
>
>
>
> I'm trying to run a compiled executable within IDL.
>
>
>
> When I run the exe in a regular shell I get the following:
>
>
>
> $ myexe
>
>
>
> Program received signal SIGSEGV: Segmentation fault - invalid memory
>
> reference.
>
>
>
> Backtrace for this error:
>
> #0 0x7FD97E7ADA77
>
> #1 0x7FD97E7AE07E
>
> #2 0x3000C3299F
>
> #3 0x45EBBB in sub1_
>
> #4 0x47688D in sub2_
>
> #5 0x409A9F in sub3_
>
> #6 0x42BABA in MAIN__ at myprog.f90:0
>
> Segmentation fault (core dumped)
>
>
>
>
>
> If I inspect the exit value I see:
>
>
>
>
>
> $ echo $?
>
> 139
>
>
>
>
>
> Now, if I do the same thing inside an IDL SPAWN command I get the following:
>
>
>
> IDL> SPAWN, 'myexe', stdout, stderr, EXIT_STATUS = exit_stat
>
>
>
> IDL> print, exit_stat
>
> 0
>
>
>
> IDL> help, stderr
>
> STDERR STRING = Array[11]
>
>
>
> IDL> print, stderr, format='(a)'
>
>
>
> Program received signal SIGSEGV: Segmentation fault - invalid memory
>
> reference.
>
>
>
> Backtrace for this error:
>
> #0 0x7F39A545DA77
>
> #1 0x7F39A545E07E
>
> #2 0x3000C3299F
>
> #3 0x45EBBB in sub1_
>
> #4 0x47688D in sub2_
>
> #5 0x409A9F in sub3_
>
> #6 0x42BABA in MAIN__ at myprog.f90:0
>
>
>
> So it's still failing but the exit_status is always 0 (i.e. successful)
>
>
>
> I've tried the command with /SH and /NOSHELL and get the same result.
>
>
>
> Does anyone have any idea why SPAWN is not setting the EXIT_STATUS
>
> correctly?
>
>
>
> cheers,
>
>
>
> paulv
>
>
>
> p.s.
>
> IDL> print, !VERSION
>
> { x86_64 linux unix linux 8.3 Nov 15 2013 64 64}
After IDL documentation, the 3rd argument and keyword EXIT_STATUS are mutually exclusive: check your STDERR argument, you should find 139 herein.
alx.
|
|
|
Re: SPAWN exit status different from shell exit status. [message #88889 is a reply to message #88872] |
Tue, 01 July 2014 11:49  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Monday, June 30, 2014 10:04:52 AM UTC-4, Paul van Delst wrote:
> Does anyone have any idea why SPAWN is not setting the EXIT_STATUS
> correctly?
Works for me.
IDL> spawn, 'bash -c "exit 10"', exit_status=exit_status
IDL> print, exit_status
----> 10
I tried IDL 7 and IDL 8, Linux and Mac.
Craig
|
|
|