[comp.sys.amiga.tech] Execute -- Why does it always return -1?

jms@tardis.Tymnet.COM (Joe Smith) (02/12/90)

In article <541@qusunb.queensu.CA> cmichael@qucis.queensu.CA (Ian Carmichael) writes:
>Does Execute always return -1?  In the following code, caller always
>prints "Success = -1", regardless of the value of N in callee.c, or even
>if callee does not exist.  Why?  What is "the right way" to get the 
>return code from Execute?

Execute returns TRUE (-1) if it able to initialize a new CLI process,
regardless of whether that CLI was able to run the specified command(s).
You can watch it fail if you type NEWCLI over and over until you have
20 CLIs in use.  Then your program will return FALSE (0) when it can't
create CLI #21.  

Since the CLI structure is deleted when the Execute()ed programs are done,
I don't think you can get the return value of the last command.

I hope they've added a function to do what you want in 1.4.
-- 
Joe Smith (408)922-6220 | SMTP: jms@tardis.tymnet.com or jms@gemini.tymnet.com
BT Tymnet Tech Services | UUCP: ...!{ames,pyramid}!oliveb!tymix!tardis!jms
PO Box 49019, MS-C41    | PDP-10 support: My car's license plate is "POPJ P,"
San Jose, CA 95161-9019 | humorous dislaimer: "My Amiga speaks for me."

sasjjr@sas.UUCP (Jack Rouse) (02/15/90)

In article <929@tardis.Tymnet.COM> jms@tardis.Tymnet.COM (Joe Smith) writes:
>Since the CLI structure is deleted when the Execute()ed programs are done,
>I don't think you can get the return value of the last command.

Apparently, since 1.2, the result code of the executed command is
returned through the secondary result (i.e. IoErr()).  This may not
work with some Execute() patches (like "SetExecute" which came with WShell
before 1.2 was available :-).
-- 
Jack Rouse, SAS Institute Inc., Box 8000, Cary, NC 27512  USA
USENET:  mcnc!rti!sas!sasjjr           TELCO :  (919) 677-8000