Skip to content

Commit

Permalink
Ensure that a supplied vstest.console path is escape sequenced (#2600)
Browse files Browse the repository at this point in the history
* Ensure that the vstest console path is escape sequenced.

* Fixing escape sequenced path only for vstest.console

* Formatting.

* PR comments addressed.
  • Loading branch information
AbhitejJohn authored Nov 2, 2020
1 parent ee65f42 commit 03b8879
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public void StartProcess(ConsoleParameters consoleParameters)
public void ShutdownProcess()
{
// Ideally process should die by itself
if(!processExitedEvent.WaitOne(ENDSESSIONTIMEOUT) && IsProcessInitialized())
if (!processExitedEvent.WaitOne(ENDSESSIONTIMEOUT) && IsProcessInitialized())
{
EqtTrace.Info($"VsTestConsoleProcessManager.ShutDownProcess : Terminating vstest.console process after waiting for {ENDSESSIONTIMEOUT} milliseconds.");
vstestConsoleExited = true;
Expand Down Expand Up @@ -220,15 +220,16 @@ private string[] BuildArguments(ConsoleParameters parameters)

if (isNetCoreRunner)
{
args.Insert(0, vstestConsolePath);
args.Insert(0, GetEscapeSequencedPath(vstestConsolePath));
}

return args.ToArray();
}

private string GetConsoleRunner()
{
return isNetCoreRunner ? ( string.IsNullOrEmpty(this.dotnetExePath) ? new DotnetHostHelper().GetDotnetPath() : this.dotnetExePath) : vstestConsolePath;
}
=> isNetCoreRunner ? (string.IsNullOrEmpty(this.dotnetExePath) ? new DotnetHostHelper().GetDotnetPath() : this.dotnetExePath) : GetEscapeSequencedPath(this.vstestConsolePath);

private string GetEscapeSequencedPath(string path)
=> string.IsNullOrEmpty(path) ? path : $"\"{path.Trim('"')}\"";
}
}

0 comments on commit 03b8879

Please sign in to comment.