Title: Streamed executable output prints Ansi Escaping in Write-* Commandlets · Issue #18771 · PowerShell/PowerShell · GitHub
Open Graph Title: Streamed executable output prints Ansi Escaping in Write-* Commandlets · Issue #18771 · PowerShell/PowerShell
X Title: Streamed executable output prints Ansi Escaping in Write-* Commandlets · Issue #18771 · 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/18771
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Streamed executable output prints Ansi Escaping in Write-* Commandlets","articleBody":"### Prerequisites\r\n\r\n- [X] Write a descriptive title.\r\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\r\n- [X] Search the existing issues.\r\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\r\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://docs.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\r\n\r\n### Steps to reproduce\r\n\r\nWhen piping input of an application to an Commandlet like Write-Error the written content contains the ansi escaping signs.\r\nFor example the command:\r\n```ps1\r\ndotnet --version | Write-Verbose -Verbose\r\n```\r\n\r\n### Expected behavior\r\n\r\nPrinting the following output in yellow:\r\n```console\r\nVERBOSE: 7.0.100\r\n```\r\n\r\n\r\n### Actual behavior\r\n\r\nThe following Text is printed colorless:\r\n```console\r\n\u001B[33;1mVERBOSE: 7.0.100\u001B[0m\r\n```\r\n\r\n\r\n### Error details\r\n\r\nIf the output is intercepted with Out-String the output seems to work correctly unless the Parameter -Stream is used. Seems like the Encoding is only broken when the text is returned as a stream down the pipline instead of at the end of the command.\r\n\r\nFor some very odd reason after I type an incorrect parameter like this:\r\n```ps1\r\ndotnet --version | Write-Verbose -u # -u does not exist\r\n```\r\nThe error-message is again displayed with ansi escape signs, but afterwards everything works as expected when I use the previous command again.\r\n\r\n### Environment data\r\n\r\n```powershell\r\nName Value\r\n---- -----\r\nPSVersion 7.3.0\r\nPSEdition Core\r\nGitCommitId 7.3.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\r\n```\r\n\r\n\r\n### Visuals\r\n\r\n\r\n","author":{"url":"https://github.com/Herrmel","@type":"Person","name":"Herrmel"},"datePublished":"2022-12-12T13:43:38.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":11},"url":"https://github.com/18771/PowerShell/issues/18771"}
| 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:9d681927-4a6d-9fab-f947-df654c5f5eec |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9854:18C7E2:BDC51F:FDB8E5:6A5319F4 |
| html-safe-nonce | 66b4fac800074a902afee524ed03b0a165fda93b4398f970362a51bcaac3996d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5ODU0OjE4QzdFMjpCREM1MUY6RkRCOEU1OjZBNTMxOUY0IiwidmlzaXRvcl9pZCI6IjIzODIxODg4OTY4MjY4ODUwMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 990096c0b4e41ebfc4ff4198cf283305f82b1c97b0af551e7b228e0dcbb71fad |
| hovercard-subject-tag | issue:1491926096 |
| 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/18771/issue_layout |
| twitter:image | https://opengraph.githubassets.com/45bd624f578db9b886241796821b24b65d9b0b511129624b7bf03e10c5b93e51/PowerShell/PowerShell/issues/18771 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/45bd624f578db9b886241796821b24b65d9b0b511129624b7bf03e10c5b93e51/PowerShell/PowerShell/issues/18771 |
| 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 | Herrmel |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width