From 44780bce38e7d0cf1a44d9dd31c4e39b3da9646c Mon Sep 17 00:00:00 2001 From: stevenknight Date: Sat, 7 Sep 2002 21:07:06 +0000 Subject: [PATCH] Win32 portability: Fix error status passing back when calling sys.exit(). git-svn-id: http://scons.tigris.org/svn/scons/trunk@460 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/engine/SCons/Script/__init__.py | 5 +++-- test/nonexistent.py | 6 ++++-- test/option-unknown.py | 12 ++++++++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index 7c499da5..cff3a215 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -1031,8 +1031,9 @@ def main(): try: _main() - except SystemExit: - pass + except SystemExit, s: + if s: + exit_status = s except KeyboardInterrupt: print "Build interrupted." sys.exit(2) diff --git a/test/nonexistent.py b/test/nonexistent.py index bacc6cec..8f2c63eb 100644 --- a/test/nonexistent.py +++ b/test/nonexistent.py @@ -32,11 +32,13 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") test.run(arguments = 'foo', - stderr = "scons: *** Do not know how to make target `foo'. Stop.\n") + stderr = "scons: *** Do not know how to make target `foo'. Stop.\n", + status = 2) test.run(arguments = '-k foo/bar foo', stderr = """scons: *** Do not know how to make target `foo/bar'. scons: *** Do not know how to make target `foo'. -""") +""", + status = 2) test.pass_test() diff --git a/test/option-unknown.py b/test/option-unknown.py index 68848a95..496a7e02 100644 --- a/test/option-unknown.py +++ b/test/option-unknown.py @@ -34,9 +34,17 @@ test = TestSCons.TestSCons(match = TestCmd.match_re) test.write('SConstruct', "") test.run(arguments = '-Z', - stderr = '\nSCons error: option -Z not recognized\nFile "\S+", line \d+, in short_has_arg\n') + stderr = """ +SCons error: option -Z not recognized +File "\S+", line \d+, in short_has_arg +""", + status = 2) test.run(arguments = '--ZizzerZazzerZuzz', - stderr = '\nSCons error: option --ZizzerZazzerZuzz not recognized\nFile "\S+", line \d+, in long_has_args\n') + stderr = """ +SCons error: option --ZizzerZazzerZuzz not recognized +File "\S+", line \d+, in long_has_args +""", + status = 2) test.pass_test() -- 2.26.2