From: stevenknight Date: Fri, 6 Mar 2009 02:14:24 +0000 (+0000) Subject: Issue 2368: Fix an exception when a null command-line argument is X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ec44f85f70f965b3d0275fd71c94c00504a7d3de;p=scons.git Issue 2368: Fix an exception when a null command-line argument is passed in. git-svn-id: http://scons.tigris.org/svn/scons/trunk@4066 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 49dfcfa6..a902e4ce 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 883af409..c70708d9 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 46c06fbd..0fa0d8a6 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()