Title: 7.4.0 Invoking pwsh -Command with stdout redirection from within PowerShell results in CLIXML instead of actual output · Issue #20808 · PowerShell/PowerShell · GitHub
Open Graph Title: 7.4.0 Invoking pwsh -Command with stdout redirection from within PowerShell results in CLIXML instead of actual output · Issue #20808 · PowerShell/PowerShell
X Title: 7.4.0 Invoking pwsh -Command with stdout redirection from within PowerShell results in CLIXML instead of actual output · Issue #20808 · PowerShell/PowerShell
Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerShell 5.1 and PowerShell. Steps to reprodu...
Open Graph Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
X Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/20808
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"7.4.0 Invoking pwsh -Command with stdout redirection from within PowerShell results in CLIXML instead of actual output","articleBody":"### Prerequisites\n\n- [X] Write a descriptive title.\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\n- [X] Search the existing issues.\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://learn.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\n\n### Steps to reproduce\n\nI ran across this by accident while trying to workaround issue #20747.\r\n\r\nIf I'm using PowerShell 7.4.0 and I invoke `pwsh` with `-Command` and I redirect the output of `pwsh` to a file, that file ends up containing CLIXML with an encoded version of the output rather than the actual output, as happens in 7.3.10\r\n\r\nWhen doing this with a script and `pwsh -File` things work as expected.\r\n\r\nThis appears to be related to the PR: [Support byte stream piping between native commands and file redirection](https://github.com/PowerShell/PowerShell/pull/17857) by @SeeminglyScience that was added in preview 4.\n\n### Expected behavior\n\n```console\nPS\u003e pwsh \u003ex.txt -Command { Write-Output \"Hello\" }\r\n\r\nPS\u003e Get-Content x.txt\r\nHello\n```\n\n\n### Actual behavior\n\n```console\nPS\u003e pwsh \u003ex.txt -Command { Write-Output \"Hello\" }\r\n\r\nPS\u003e Get-Content x.txt\r\n#\u003c CLIXML\r\n\u003cObjs Version=\"1.1.0.1\" xmlns=\"http://schemas.microsoft.com/powershell/2004/04\"\u003e\u003cS S=\"Output\"\u003eHello\u003c/S\u003e\u003c/Objs\u003e\n```\n\n\n### Error details\n\n```console\nNo error invovled.\n```\n\n\n### Environment data\n\n```powershell\nName Value\r\n---- -----\r\nPSVersion 7.4.0\r\nPSEdition Core\r\nGitCommitId 7.4.0\r\nOS Microsoft Windows 10.0.19044\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\n```\n\n\n### Visuals\n\n### 7.3.10\r\n\r\n\r\n### 7.4.0\r\n\r\n","author":{"url":"https://github.com/twinter-amosfivesix","@type":"Person","name":"twinter-amosfivesix"},"datePublished":"2023-11-29T16:20:31.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/20808/PowerShell/issues/20808"}
| 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:2cfb02c8-6268-1f15-3710-f1ef06bd0d79 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C5A2:48ECA:B96B54:FA5D76:6A56FDAE |
| html-safe-nonce | 074161315071b4bfec77a438f525a7029eee29b1410a808cbad80ab4f131f378 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNUEyOjQ4RUNBOkI5NkI1NDpGQTVENzY6NkE1NkZEQUUiLCJ2aXNpdG9yX2lkIjoiODg0MTQxNzE1MjQ0MTgxMDM1MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9f2e7e5a05d4f196eda255c7a61851545e64947c3bf7f524e66aa0a0eba8c821 |
| hovercard-subject-tag | issue:2016955854 |
| 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/20808/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c4caca8ba95b49d8f2e9a5e3c4a7d5a85a3866c99c75e248a5539fa74a21020f/PowerShell/PowerShell/issues/20808 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c4caca8ba95b49d8f2e9a5e3c4a7d5a85a3866c99c75e248a5539fa74a21020f/PowerShell/PowerShell/issues/20808 |
| og:image:alt | Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | twinter-amosfivesix |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb29e5f807bd95e41196adfbc6d28f9af12d89830d8b684f3e871774ddff2fc |
| 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 | b056788a129fb0194b61f2ebb4c43f6a9f4dfd27 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width