I was curios about the -1 exit code and tried invoking:
system("cmd.exe /c dir system.icn") # gives exit code 0
Some of the other obvious options for cmd.exe don't yield a -1 return code.
Using cmd rather than cmd.exe makes no difference.
I had a look into runtime/ rlocal.r, fsys.r, and fxposix.ri and I'm left
scratching my head a bit. (I last pulled CVS about mid May). The posix code
seems most relevant and checks for internal commands. It seems to generate
"cmd
/c ...".
David
________________________________
From: Jafar Al-Gharaibeh <[email protected]>
To: [email protected]
Cc: David Gamey <[email protected]>; [email protected]
Sent: Sun, August 1, 2010 3:04:46 PM
Subject: Re: [Unicon-group] Unicon 11.7/Windows(7) - system() bug
On Sun, Aug 1, 2010 at 2:49 PM, Clinton Jeffery <[email protected]> wrote:
"dir" is not defined on Linux so I am not sure what the point of comparing
"dir"
on Linux with that on Windows.
dir works on linux. At least it does on Fedora 12.
>
>"dir" is not an executable program on Windows, either, it is an "internal"
>part
>of the Windows shell, cmd.exe or some such. Unicon tries to recognize
>internals
>commands and executes them with an invocation of cmd.exe and the -1 is what
>cmd.exe is returning for some reason.
>
>
>As far as "wait" and "nowait", "wait" is the default and should have no
>effect.
> "nowait" should probably do something other than fail. It is worth looking
>into.
>
>
>
>On Sun, Aug 1, 2010 at 6:34 AM, Jafar Al-Gharaibeh <[email protected]> wrote:
>
>David,
>>
>> Just to compare with Linux, (running Fedora 12), I ran you program after
>>changing system.exe to system and fixing the second "nowait" to be "wait",
>>here
>>is what I got. How is that different from what you are getting ?
>>
>>[ja...@precision projects]$ ./system
>>Unicon Version 11.7. January 22, 2010
>>Select
>>- dir
>>- dir-nowait
>>- dir-wait
>>dir
>>system.icn : 14 | SYSTEM(list_2 = ["dir system.icn"])
>>system.icn
>>system.icn : 20 | SYSTEM returned 0
>>exit code=0
>>system.icn : 18 main failed
>>
>>[ja...@precision projects]$ ./system
>>Unicon Version 11.7. January 22, 2010
>>Select
>>- dir
>>- dir-nowait
>>- dir-wait
>>dir-nowait
>>system.icn : 15 | SYSTEM(list_2 = ["dir
>>system",&input,&output,&errout,"nowait"])
>>system.icn : 20 | SYSTEM returned 2338
>>Child PID.1=2338
>>system.icn : 18 main failed
>>
>>[ja...@precision projects]$ ./system
>>Unicon Version 11.7. January 22, 2010
>>Select
>>- dir
>>- dir-nowait
>>- dir-wait
>>dir-wait
>>system.icn : 16 | SYSTEM(list_2 = ["dir
>>system",&input,&output,&errout,"wait"])
>>system
>>system.icn : 20 | SYSTEM returned 0
>>Child PID.2=0
>>system.icn : 18 main failed
>>[ja...@precision projects]$
>>
>>
>>Jafar
>>
>>
>>
>>
>>
>>On Sun, Aug 1, 2010 at 8:47 AM, David Gamey <[email protected]> wrote:
>>
>>Folks,
>>>
>>>The system function is behaving unexpectedly:
>>>
>>> * system("dir...") works but returns -1 - not sur if that's normal
>>> * system() with wait and nowait works but fail.Version gives: Unicon
>>> Version
>>>11.7. January 22, 2010
>>>
>>>The program below illustrates:
>>>
>>>
>>>procedure main()
>>>write(&version)
>>>SYSTEM :=: system
>>>&trace := -1
>>>SEL := ["dir","dir-nowait","dir-wait"]
>>>until \op do {
>>> write("Select")
>>> every write("- ",!SEL)
>>> opt := read()
>>> if opt == !SEL then break
>>> }
>>>
>>>case opt of {
>>>SEL[1]:write("exit code=",system("dir system.icn"))
>>>SEL[2]:write("Child PID.1=",system("dir
>>>system.exe",&input,&output,&errout,"nowait"))
>>>SEL[3]:write("Child PID.2=",system("dir
>>>system.exe",&input,&output,&errout,"nowait"))
>>>}
>>>end
>>>
>>>procedure SYSTEM(x[]); return SYSTEM!x; end
>>>
>>>David
>>>
>>>------------------------------------------------------------------------------
>>>The Palm PDK Hot Apps Program offers developers who use the
>>>Plug-In Development Kit to bring their C/C++ apps to Palm for a share
>>>of $1 Million in cash or HP Products. Visit us here for more details:
>>>http://p.sf.net/sfu/dev2dev-palm
>>>_______________________________________________
>>>Unicon-group mailing list
>>>[email protected]
>>>https://lists.sourceforge.net/lists/listinfo/unicon-group
>>>
>>>
>>
>>
>>--
>>"Let there be no compulsion in religion: Truth stands out clear from error"
>>[The
>>Holy Qur'an 2:256]
>>
>>"Injustice anywhere is a threat to justice everywhere" Dr. King
>>
>>------------------------------------------------------------------------------
>>The Palm PDK Hot Apps Program offers developers who use the
>>Plug-In Development Kit to bring their C/C++ apps to Palm for a share
>>of $1 Million in cash or HP Products. Visit us here for more details:
>>http://p.sf.net/sfu/dev2dev-palm
>>_______________________________________________
>>Unicon-group mailing list
>>[email protected]
>>https://lists.sourceforge.net/lists/listinfo/unicon-group
>>
>>
>
--
"Let there be no compulsion in religion: Truth stands out clear from error"
[The
Holy Qur'an 2:256]
"Injustice anywhere is a threat to justice everywhere" Dr. King
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Unicon-group mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/unicon-group