-
Notifications
You must be signed in to change notification settings - Fork 959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Powershell does not return the correct non-zero exit code #351
Labels
Runner Bug
Bug fix scope to the runner
Comments
@thboop - this is a dupe right? |
I do not believe so. |
TingluoHuang
added
runner
Runner Bug
Bug fix scope to the runner
and removed
bug
Something isn't working
runner
labels
Jun 6, 2020
Is this being worked on? This is causing a lot of problems for us. |
anthonysessa
added a commit
to anthonysessa/runner
that referenced
this issue
Oct 28, 2020
Output correct error codes actions#351
Hi all... any updates on this? |
This problem makes it easy to miss test failures on Windows! IMHO it should be prioritized. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Powershell does not return the correct exit code if it is non-zero and not 1.
To Reproduce
Steps to reproduce the behavior:
cmd
andbash
and the error frompwsh
.Expected behavior
For powershell to return the exit code returned by the script.
Runner Version and Platform
Current runner version: 2.165.2
Tested on ubuntu-latest, macos-latest and windows-latest
See https://github.com/johnstevenson/runner-actions-test/actions/runs/48202446 for tests that use
.bat
,.sh
and.ps1
scripts rather than using the php code.What's not working?
The code that is appended to the powershell script in
FixUpScriptContents
:runner/src/Runner.Worker/Handlers/ScriptHandlerHelpers.cs
Line 59 in d80ab09
This can be fixed by either changing the line to:
or by executing the script as a file, rather than a command which always returns the correct exit code:
runner/src/Runner.Worker/Handlers/ScriptHandlerHelpers.cs
Lines 12 to 13 in d80ab09
Incidentally, the documentation at https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell shows the powershell internal commands as
pwsh -command "& '{0}'"
rather thanpwsh -command ". '{0}'"
, but I'm not sure where to report this.The text was updated successfully, but these errors were encountered: