[Tutor] Getting exit code in Windows

Sheila King sheila@thinkspot.net
Sun, 31 Mar 2002 21:24:31 -0800


On Mon, 1 Apr 2002 00:19:24 -0600, Victor R. Cardona wrote:
> Hi everyone,
>
> I am writing a simple shell in python as a small demonstration
> project.
> I have figured out how to get the exit code for a process on UNIX
> using the waitpid function in the os module. Unfortunately, this
> function does not seem to exist on Windows. Is there a portable way
> of getting that kind of information? I know I could use the
> win32all extensions, but I wanted to make sure there was not a
> better way.
>
>
> Thanks, Victor

I've written portable scripts that I run on both Unix and Windows, 
that return the exit code with the following command:

sys.exit(int)

You must import the sys module and pass an integer as the parameter.


-- 
Sheila King
http://www.thinkspot.net/sheila/