On May 8, 5:28 pm, Rolf Magnus <ramag...@[EMAIL PROTECTED]
> wrote:
> titanandrews wrote:
> > On May 8, 2:30 pm, Martin York <Martin.YorkAma...@[EMAIL PROTECTED]
> wrote:
> >> On May 8, 9:05 am, titanandrews <titanandr...@[EMAIL PROTECTED]
> wrote:
>
> >> > Does anyone know if this can be done?
>
> >> Yes. But not that way.
> >> If you bring up cmd.exe
>
> >> run the application in cmd.exe
> >> Then you can print the exit code via the variabel %ERRORLEVEL%
>
> >> <command>
> >> echo %ERRORLEVEL%
>
> >> If you want to do it automatically just wrap it all in a small script
> >> that runs the code and then prints %ERRORLEVEL%
>
> >> On Unix/Linux systems you can do the same thing.
> >> The exact code depends on what shell you are using:
>
> >> In tcsh
> >> ./<COMMAND>
> >> echo $?
>
> > Thanks. But thats after the process has ended. By then, it's too
> > late. :(
>
> I don't understand that. The process has no exit code before it has
ended,
> so how would you expect to be able to get one?
Well the exit code that was used for the exit function call is stored
in memory somewhere. The exit function doesn't just immediately
terminate the program. A whole bunch of other stuff happens first,
i.e. resources freed, exit handlers called, etc.
That variable has to be stored somewhere so that you end up with value
1 when the process finally ends.


|