Merge pull request #327 from schellap/patch
Fix restore.cmd/sh not recognizable command
This commit is contained in:
commit
aadc1987cb
2 changed files with 17 additions and 4 deletions
|
@ -57,11 +57,18 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
|
|
||||||
private static void ResolveExecutablePath(ref string executable, ref string args)
|
private static void ResolveExecutablePath(ref string executable, ref string args)
|
||||||
{
|
{
|
||||||
var fullExecutable = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, executable + Constants.ExeSuffix));
|
foreach (string suffix in Constants.RunnableSuffixes)
|
||||||
|
|
||||||
if (File.Exists(fullExecutable))
|
|
||||||
{
|
{
|
||||||
executable = fullExecutable;
|
var fullExecutable = Path.GetFullPath(Path.Combine(
|
||||||
|
AppContext.BaseDirectory, executable + suffix));
|
||||||
|
|
||||||
|
if (File.Exists(fullExecutable))
|
||||||
|
{
|
||||||
|
executable = fullExecutable;
|
||||||
|
|
||||||
|
// In priority order we've found the best runnable extension, so break.
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// On Windows, we want to avoid using "cmd" if possible (it mangles the colors, and a bunch of other things)
|
// On Windows, we want to avoid using "cmd" if possible (it mangles the colors, and a bunch of other things)
|
||||||
|
|
|
@ -12,6 +12,12 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
internal static class Constants
|
internal static class Constants
|
||||||
{
|
{
|
||||||
public static readonly string ExeSuffix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : string.Empty;
|
public static readonly string ExeSuffix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : string.Empty;
|
||||||
|
|
||||||
|
// Priority order of runnable suffixes to look for and run
|
||||||
|
public static readonly string[] RunnableSuffixes = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
|
||||||
|
? new string[] { ".exe", ".cmd", ".bat" }
|
||||||
|
: new string[] { string.Empty };
|
||||||
|
|
||||||
public static readonly string HostExecutableName = "corehost" + ExeSuffix;
|
public static readonly string HostExecutableName = "corehost" + ExeSuffix;
|
||||||
public static readonly string DefaultConfiguration = "Debug";
|
public static readonly string DefaultConfiguration = "Debug";
|
||||||
public static readonly string BinDirectoryName = "bin";
|
public static readonly string BinDirectoryName = "bin";
|
||||||
|
|
Loading…
Add table
Reference in a new issue