set default shell to powershell in windows (#135)

* set default shell to powershell in windows

* Update error checking

* Update error message
This commit is contained in:
Thomas Boop
2019-10-21 14:08:12 -04:00
committed by GitHub
parent 05f0b938ac
commit 9d7b0a2405

View File

@@ -60,10 +60,10 @@ namespace GitHub.Runner.Worker.Handlers
if (string.IsNullOrEmpty(shell))
{
#if OS_WINDOWS
shellCommand = "cmd";
shellCommand = "powershell";
if(validateShellOnHost)
{
shellCommandPath = System.Environment.GetEnvironmentVariable("ComSpec");
shellCommandPath = WhichUtil.Which(shellCommand, true, Trace);
}
#else
shellCommand = "sh";
@@ -143,9 +143,9 @@ namespace GitHub.Runner.Worker.Handlers
if (string.IsNullOrEmpty(shell))
{
#if OS_WINDOWS
shellCommand = "cmd";
commandPath = System.Environment.GetEnvironmentVariable("ComSpec");
ArgUtil.NotNullOrEmpty(commandPath, "%ComSpec%");
shellCommand = "powershell";
commandPath = WhichUtil.Which(shellCommand, true, Trace);
ArgUtil.NotNullOrEmpty(commandPath, "Default Shell");
#else
shellCommand = "sh";
commandPath = WhichUtil.Which("bash", false, Trace) ?? WhichUtil.Which("sh", true, Trace);