From 9d7b0a24059cd894a5e3acdafba71552c4a09c4f Mon Sep 17 00:00:00 2001 From: Thomas Boop <52323235+thboop@users.noreply.github.com> Date: Mon, 21 Oct 2019 14:08:12 -0400 Subject: [PATCH] set default shell to powershell in windows (#135) * set default shell to powershell in windows * Update error checking * Update error message --- src/Runner.Worker/Handlers/ScriptHandler.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Runner.Worker/Handlers/ScriptHandler.cs b/src/Runner.Worker/Handlers/ScriptHandler.cs index ab6dda544..182913049 100644 --- a/src/Runner.Worker/Handlers/ScriptHandler.cs +++ b/src/Runner.Worker/Handlers/ScriptHandler.cs @@ -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);