From 2d5c3a3ba4186a173597b30a76ad038277db94fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Karlas=CC=8C?= Date: Mon, 18 Sep 2017 16:12:59 +0200 Subject: [PATCH 1/2] Put quotes around TestHost path so in case of spaces in name it starts correctly --- .../Hosting/DefaultTestHostManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs index 0e0527d6ad..6c3594af21 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs @@ -169,7 +169,7 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( !this.processHelper.GetCurrentProcessFileName().EndsWith(DotnetHostHelper.MONOEXENAME, StringComparison.OrdinalIgnoreCase)) { launcherPath = this.dotnetHostHelper.GetMonoPath(); - argumentsString = testhostProcessPath + " " + argumentsString; + argumentsString = testhostProcessPath.AddDoubleQuote() + " " + argumentsString; } // For IDEs and other scenario, current directory should be the From bbdf5ee9dad4587ec1b6092ac405bce3a8c8b01b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Karlas=CC=8C?= Date: Tue, 19 Sep 2017 09:43:16 +0200 Subject: [PATCH 2/2] Made unit test more strict to ensure path has quotes --- .../Hosting/DefaultTestHostManagerTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs index b8d2500ed3..71ca028046 100644 --- a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs +++ b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs @@ -162,7 +162,7 @@ public void GetTestHostProcessStartInfoShouldUseMonoAsHostOnNonWindowsIfNotStart default(TestRunnerConnectionInfo)); Assert.AreEqual("/usr/bin/mono", info.FileName); - StringAssert.Contains(info.Arguments, "TestHost" + Path.DirectorySeparatorChar + "testhost.exe"); + StringAssert.Contains(info.Arguments, "TestHost" + Path.DirectorySeparatorChar + "testhost.exe\""); } [TestMethod]