[IronPython] SystemExitException ?
Orestis Markou
orestis at resolversystems.com
Fri Nov 21 14:24:03 CET 2008
Hello,
In Resolver, we have our own RSIronPython.exe that sets up the
environment (PATH and other things) and executes a program. It's not
interactive - just a wrapper aroung ExecuteProgram, really.
We used to do this:
try
{
ScriptSource source =
engine.CreateScriptSourceFromFile(Path.Combine(currentDir,
(string)args[0]));
source.ExecuteProgram();
}
catch (SystemExitException e)
{
object o;
return e.GetExitCode(out o);
}
catch (Exception e)
{
ExceptionOperations eo = engine.GetService<ExceptionOperations>();
Console.Write(eo.FormatException(e));
return 1;
}
return 0;
But then we realised that we always returned 0, because
SystemExitException was never raised, even if a PythonScript did an
exlicit sys.exit or raised SystemExit. So we now return the result of
source.ExecuteProgram().
I'm just wondering if we should care about SystemExitException (a quick
grep of the source is indicating that it's only used in
PythonCommandLine), or if it's handled for us at a lower level.
Thanks,
Orestis
--
Orestis Markou
Software Engineer,
Resolver Systems Ltd.
orestis at resolversystems.com
+44 (0) 20 7253 6372
More information about the Ironpython-users
mailing list