Title: Script via STDIN does not exit with error code and does not stop correctly · Issue #15331 · PowerShell/PowerShell · GitHub
Open Graph Title: Script via STDIN does not exit with error code and does not stop correctly · Issue #15331 · PowerShell/PowerShell
X Title: Script via STDIN does not exit with error code and does not stop correctly · Issue #15331 · PowerShell/PowerShell
Description: Steps to reproduce Link to a related Problem in GitLab: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27830#note_564599211 Test.ps1: $ErrorActionPreference = 'Stop' just bogus Write-Host 'hello' Batch-Call (working correctly with ...
Open Graph Description: Steps to reproduce Link to a related Problem in GitLab: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27830#note_564599211 Test.ps1: $ErrorActionPreference = 'Stop' just bogus Write-Host 'he...
X Description: Steps to reproduce Link to a related Problem in GitLab: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27830#note_564599211 Test.ps1: $ErrorActionPreference = 'Stop' just bogus Write-...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/15331
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Script via STDIN does not exit with error code and does not stop correctly","articleBody":"\u003c!--\r\n\r\nFor Windows PowerShell 5.1 issues, suggestions, or feature requests please use the following link instead:\r\nWindows PowerShell [UserVoice](https://windowsserver.uservoice.com/forums/301869-powershell)\r\n\r\nThis repository is **ONLY** for PowerShell Core 6 and PowerShell 7+ issues.\r\n\r\n- Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\r\n- Search the existing issues.\r\n- Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\r\n- Refer to the [known issues](https://docs.microsoft.com/powershell/scripting/whats-new/known-issues-ps6).\r\n\r\n--\u003e\r\n\r\n\r\n## Steps to reproduce\r\n\r\nLink to a related Problem in GitLab:\r\nhttps://gitlab.com/gitlab-org/gitlab-runner/-/issues/27830#note_564599211\r\n\r\nTest.ps1:\r\n```powershell\r\n$ErrorActionPreference = 'Stop'\r\njust bogus\r\nWrite-Host 'hello'\r\n```\r\n\r\nBatch-Call (working correctly with file)\r\n```none\r\npwsh -File Test.ps1\r\n```\r\nExit-Code: 1\r\n\r\nBatch-Call (working correctly with stdin)\r\n```none\r\ntype Test.ps1 | pwsh -noprofile -noninteractive -command \"$input | iex\"\r\n```\r\nExit-Code: 1\r\n\r\nBatch-Call (not working correctly with stdin)\r\n```none\r\ntype Test.ps1 | pwsh -Command -\r\n```\r\nExit-Code: 0\r\n\r\n\r\n\r\n## Expected behavior\r\n\r\n```none\r\nPowershell quits with non zero exit code and does not print \"hello\", but an exception for \"just bogus\"\r\n```\r\n\r\n## Actual behavior\r\n\r\n```none\r\nPowershell does execute all statement even though $ErrorActionPreference is set to \"stop\"\r\n```\r\n\r\n","author":{"url":"https://github.com/Scordo","@type":"Person","name":"Scordo"},"datePublished":"2021-04-30T13:47:08.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":32},"url":"https://github.com/15331/PowerShell/issues/15331"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7b7c501b-5d39-6c5e-4dfc-abe0a4340bc6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D99C:1D1D7A:F567C1:147D826:6A59AAEF |
| html-safe-nonce | 9d7efb6b6f10d0f04356a8ea6c652987cd72de2f2a3fe1f9cb822fc0fc67a5eb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTlDOjFEMUQ3QTpGNTY3QzE6MTQ3RDgyNjo2QTU5QUFFRiIsInZpc2l0b3JfaWQiOiI3MjMwMTAzMjI4NjcxMTc1NDA3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 69e0d16f798a63fc300f708243ee584afe12f19b341bf24c3f3fb3b8a278b2a6 |
| hovercard-subject-tag | issue:872541443 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/15331/issue_layout |
| twitter:image | https://opengraph.githubassets.com/88fab9876a8a7d178c03cbbfdc8b5216901107173d41c97f7b1e63bb08d3c4ae/PowerShell/PowerShell/issues/15331 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/88fab9876a8a7d178c03cbbfdc8b5216901107173d41c97f7b1e63bb08d3c4ae/PowerShell/PowerShell/issues/15331 |
| og:image:alt | Steps to reproduce Link to a related Problem in GitLab: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27830#note_564599211 Test.ps1: $ErrorActionPreference = 'Stop' just bogus Write-Host 'he... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Scordo |
| hostname | github.com |
| expected-hostname | github.com |
| None | ba3976babb66479b1c943a8edc0777d96157da48fadc0161f9ddb219deee8353 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ab680789ae4a316cdaf0d5a292a1760140931cc4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width