mirror of
https://github.com/actions/runner.git
synced 2025-12-12 14:17:46 +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
|
## Features
|
||||||
- Set Default shell to powershell for windows runners (#135)
|
- 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
|
## Bugs
|
||||||
- Removed unintended additional fields on error and warning commands (#137)
|
- Removed unintended additional fields on error and warning commands (#137)
|
||||||
|
|||||||
@@ -60,10 +60,16 @@ namespace GitHub.Runner.Worker.Handlers
|
|||||||
if (string.IsNullOrEmpty(shell))
|
if (string.IsNullOrEmpty(shell))
|
||||||
{
|
{
|
||||||
#if OS_WINDOWS
|
#if OS_WINDOWS
|
||||||
shellCommand = "powershell";
|
shellCommand = "pwsh";
|
||||||
if(validateShellOnHost)
|
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
|
#else
|
||||||
shellCommand = "sh";
|
shellCommand = "sh";
|
||||||
@@ -143,8 +149,14 @@ namespace GitHub.Runner.Worker.Handlers
|
|||||||
if (string.IsNullOrEmpty(shell))
|
if (string.IsNullOrEmpty(shell))
|
||||||
{
|
{
|
||||||
#if OS_WINDOWS
|
#if OS_WINDOWS
|
||||||
shellCommand = "powershell";
|
shellCommand = "pwsh";
|
||||||
commandPath = WhichUtil.Which(shellCommand, true, Trace);
|
commandPath = WhichUtil.Which(shellCommand, require: false, Trace);
|
||||||
|
if (string.IsNullOrEmpty(commandPath))
|
||||||
|
{
|
||||||
|
shellCommand = "powershell";
|
||||||
|
Trace.Info($"Defaulting to {shellCommand}");
|
||||||
|
commandPath = WhichUtil.Which(shellCommand, require: true, Trace);
|
||||||
|
}
|
||||||
ArgUtil.NotNullOrEmpty(commandPath, "Default Shell");
|
ArgUtil.NotNullOrEmpty(commandPath, "Default Shell");
|
||||||
#else
|
#else
|
||||||
shellCommand = "sh";
|
shellCommand = "sh";
|
||||||
|
|||||||
Reference in New Issue
Block a user