Fix dotnet driver on windows to deal with spaces
dotnet driver fails running dotnet-restore.cmd if this file is in a path containing spaces. Use the magic "/S" switch in cmd to fix this.
This commit is contained in:
parent
fcdc8513ef
commit
cd357cb273
1 changed files with 2 additions and 8 deletions
|
@ -88,14 +88,8 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
if (useCmd)
|
if (useCmd)
|
||||||
{
|
{
|
||||||
var comSpec = Environment.GetEnvironmentVariable("ComSpec");
|
var comSpec = Environment.GetEnvironmentVariable("ComSpec");
|
||||||
|
// wrap 'executable' within quotes to deal woth space in its path.
|
||||||
// cmd doesn't like "foo.exe ", so we need to ensure that if
|
args = $"/S /C \"\"{executable}\" {args}\"";
|
||||||
// args is empty, we just run "foo.exe"
|
|
||||||
if (!string.IsNullOrEmpty(args))
|
|
||||||
{
|
|
||||||
executable = (executable + " " + args).Replace("\"", "\\\"");
|
|
||||||
}
|
|
||||||
args = $"/C \"{executable}\"";
|
|
||||||
executable = comSpec;
|
executable = comSpec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue