From 47a5f6f17fa7f72065bd42dec4d645e5c1325aef Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Fri, 6 Mar 2009 02:14:24 +0000 Subject: Issue 2368: Fix an exception when a null command-line argument is passed in. --- src/CHANGES.txt | 2 ++ src/engine/SCons/Script/Main.py | 2 +- test/no-arguments.py | 17 ++++++++++++++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 49dfcfa..a902e4c 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -19,6 +19,8 @@ RELEASE X.X.X - XXX - Fix a TypeError on #include of file names with Unicode characters. + - Fix an exception if a null command-line argument is passed in. + RELEASE 1.2.0.d20090223 - Mon, 23 Feb 2009 08:41:06 -0800 diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index 883af40..c70708d 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -868,7 +868,7 @@ def _main(parser): targets = [] xmit_args = [] for a in parser.largs: - if a[0] == '-': + if a[:1] == '-': continue if '=' in a: xmit_args.append(a) diff --git a/test/no-arguments.py b/test/no-arguments.py index 46c06fb..0fa0d8a 100644 --- a/test/no-arguments.py +++ b/test/no-arguments.py @@ -26,8 +26,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify that we use a default target of the current directory when there -are no command-line arguments (and, implicitly, no Default() in the -SConstruct). +is no Default() in the SConstruct file and there are no command-line +arguments, or a null command-line argument. """ import os.path @@ -52,10 +52,21 @@ env.Build('aaa.out', 'aaa.in') test.write('aaa.in', "aaa.in\n") +up_to_date = test.wrap_stdout("scons: `.' is up to date.\n") + # test.run() +test.must_match('aaa.out', "aaa.in\n") +test.run(stdout=up_to_date) + +# +test.unlink('aaa.out') +test.must_not_exist('aaa.out') -test.fail_test(test.read('aaa.out') != "aaa.in\n") +# +test.run(['']) +test.must_match('aaa.out', "aaa.in\n") +test.run([''], stdout=up_to_date) # test.pass_test() -- cgit v0.12