mirror of
https://github.com/actions/runner.git
synced 2025-12-12 05:37:01 +00:00
Default to pwsh with powershell as a fallback (#142)
* Default to pwsh with powershell as a fallback * Update releaseNote.md * clean up code
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
## Features
|
||||
- Set Default shell to powershell for windows runners (#135)
|
||||
- Use Powershell as fallback if Powershell Core is not available for default shell on windows (#142)
|
||||
|
||||
## Bugs
|
||||
- Removed unintended additional fields on error and warning commands (#137)
|
||||
|
||||
@@ -60,10 +60,16 @@ namespace GitHub.Runner.Worker.Handlers
|
||||
if (string.IsNullOrEmpty(shell))
|
||||
{
|
||||
#if OS_WINDOWS
|
||||
shellCommand = "powershell";
|
||||
shellCommand = "pwsh";
|
||||
if(validateShellOnHost)
|
||||
{
|
||||
shellCommandPath = WhichUtil.Which(shellCommand, true, Trace);
|
||||
shellCommandPath = WhichUtil.Which(shellCommand, require: false, Trace);
|
||||
if (string.IsNullOrEmpty(shellCommandPath))
|
||||
{
|
||||
shellCommand = "powershell";
|
||||
Trace.Info($"Defaulting to {shellCommand}");
|
||||
shellCommandPath = WhichUtil.Which(shellCommand, require: true, Trace);
|
||||
}
|
||||
}
|
||||
#else
|
||||
shellCommand = "sh";
|
||||
@@ -143,8 +149,14 @@ namespace GitHub.Runner.Worker.Handlers
|
||||
if (string.IsNullOrEmpty(shell))
|
||||
{
|
||||
#if OS_WINDOWS
|
||||
shellCommand = "pwsh";
|
||||
commandPath = WhichUtil.Which(shellCommand, require: false, Trace);
|
||||
if (string.IsNullOrEmpty(commandPath))
|
||||
{
|
||||
shellCommand = "powershell";
|
||||
commandPath = WhichUtil.Which(shellCommand, true, Trace);
|
||||
Trace.Info($"Defaulting to {shellCommand}");
|
||||
commandPath = WhichUtil.Which(shellCommand, require: true, Trace);
|
||||
}
|
||||
ArgUtil.NotNullOrEmpty(commandPath, "Default Shell");
|
||||
#else
|
||||
shellCommand = "sh";
|
||||
|
||||
Reference in New Issue
Block a user