Hello guys!
I enjoy you work on nant. It's simply the best tool for building in my opinion. But while working with it, i recognized a bug in your <exec> task. In one of my nant scripts i used following part of a target:
<exec basedir="${tools.dir}\NUnit\bin"
useruntimeengine="true"
workingdir="${test.dir}TestExceptions\temp"
program="nunit-console.exe"
commandline="${test.dir}TestExceptions\bin\Debug\TestExceptions.dll"
if="${debug}"/>
If ${test.dir} contains a blank, like 'C:\Dokumente und Einstellungen\Fabian.Wohlschlaeger\Desktop\v2\Test\' following exception is thrown:
[echo] Test des Projekts Exceptions
[exec] NUnit version 2.4.3
[exec] Copyright (C) 2002-2007 Charlie Poole.
[exec] Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
[exec] Copyright (C) 2000-2002 Philip Craig.
[exec] All Rights Reserved.
[exec] Runtime Environment -
[exec] OS Version: Microsoft Windows NT 5.1.2600.0
[exec] CLR Version: 1.1.4322.2407 ( Net 1.1.4322.2407 )
[exec] Unhandled Exception:
[exec] System.IO.DirectoryNotFoundException: Ein Teil des Pfades Einstellungen\Fabian.Wohlschlaeger\Desktop\v2\Test\TestExceptions\bin\Release konnte nicht gefunden werden.
[exec] Server stack trace:
[exec] at System.IO.__Error.WinIOError(Int32 errorCode, String str)
[exec] at System.IO.Directory.SetCurrentDirectory(String path)
[exec] at NUnit.Core.DirectorySwapper..ctor(String directoryName)
[exec] at NUnit.Core.Builders.TestAssemblyBuilder.Load(String path)
[exec] at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites)
[exec] at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites)
[exec] at NUnit.Core.TestSuiteBuilder.BuildSingleAssembly(TestPackage package)
[exec] at NUnit.Core.TestSuiteBuilder.Build(TestPackage package)
[exec] at NUnit.Core.SimpleTestRunner.Load(TestPackage package)
[exec] at NUnit.Core.DelegatingTestRunner.Load(TestPackage package)
[exec] at NUnit.Core.DelegatingTestRunner.Load(TestPackage package)
[exec] at NUnit.Core.RemoteTestRunner.Load(TestPackage package)
[exec] at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
[exec] at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
[exec] Exception rethrown at [0]:
[exec] at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
[exec] at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
[exec] at NUnit.Core.TestRunner.Load(TestPackage package)
[exec] at NUnit.Util.TestDomain.Load(TestPackage package)
[exec] at NUnit.Util.MultipleTestDomainRunner.Load(TestPackage package)
[exec] at NUnit.ConsoleRunner.ConsoleUi.MakeRunnerFromCommandLine(ConsoleOptions options)
[exec] at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options)
[exec] at NUnit.ConsoleRunner.Runner.Main(String[] args)
BUILD FAILED
C:\Dokumente und Einstellungen\Fabian.Wohlschlaeger\Desktop\v2\Test\TestExceptions\NAnt.build(62,4):
External Program Failed: C:\Dokumente und Einstellungen\Fabian.Wohlschlaeger\Desktop\v2\Tools\NUnit\bin\nunit-console.exe (return code was -100)
Logged In: YES
user_id=707851
Originator: NO
This is by design. The "commandline" parameter does not automatically quotes value.
Either quote the value yourself (commandline=""{test.dir}TestExceptions\bin\Debug\TestExceptions.dll""), or use the nested arg element instead (which will take care of the quoting):
<exec ....>
<arg file="{test.dir}TestExceptions\bin\Debug\TestExceptions.dll" />
</exec>
I've now clarified this in the docs (in CVS).