Title: `conhost.exe` console windows on Windows: cmdlets, e.g. `Select-String`, do not render VT (ANSI) escape sequences in their for-display output with direct input from native (external) programs · Issue #20898 · PowerShell/PowerShell · GitHub
Open Graph Title: `conhost.exe` console windows on Windows: cmdlets, e.g. `Select-String`, do not render VT (ANSI) escape sequences in their for-display output with direct input from native (external) programs · Issue #20898 · PowerShell/PowerShell
X Title: `conhost.exe` console windows on Windows: cmdlets, e.g. `Select-String`, do not render VT (ANSI) escape sequences in their for-display output with direct input from native (external) programs · Issue #20898 · 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/20898
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`conhost.exe` console windows on Windows: cmdlets, e.g. `Select-String`, do not render VT (ANSI) escape sequences in their for-display output with direct input from native (external) programs ","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://learn.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\r\n\r\n### Steps to reproduce\r\n\r\n* A reopening of #18294, #18771, and #19813, which were inappropriately closed as `Resolution-External`.\r\n* The problem still exists in v7.4.0, and was introduced in 7.3.0-preview.2, according to @Hermel's findings.\r\n\r\nTo recap the repro steps: The problem occurs:\r\n\r\n* on Windows\r\n* in regular console windows (`conhost.exe`), _not_ in Windows Terminal\r\n * with the `VirtualTerminalLevel` registry value in key `HKEY_CURRENT_USER\\Console` NOT manually set to `1`, i.e. either set to `0` or - as is the default - with the value _not defined_.\r\n* with input from _external programs_\r\n\r\n\r\n```powershell\r\n# From a conhost.exe console window on Windows,\r\n# with the defaults (see note re `VirtualTerminalLevel` above).\r\ncmd /c echo foo | Select-String f\r\n```\r\n\r\nSuboptimal workarounds: \r\n\r\n* Enclose the external-program call in `(...)`\r\n* Enable ANSI/VT support in `conhost.exe` console windows _system-wide_, via the registry:\r\n * `Set-ItemProperty HKCU:\\Console VirtualTerminalLevel -Type DWORD 1`\r\n * The preferable alternative, namely to make PowerShell _itself_ unconditionally enable ANSI/VT support (something that Windows Terminal already does), was declined, even though it would be less drastic than a _system-wide_ setting: https://github.com/PowerShell/PowerShell/issues/19101#issuecomment-1480308331\r\n\r\nSuspected cause, quoting @SeeminglyScience from https://github.com/PowerShell/PowerShell/issues/18294#issuecomment-1281181217: \r\n\r\n\u003e I would guess it's related to https://github.com/PowerShell/PowerShell/pull/16612 but I've looked it over and I can't easily see how. We should be re-enabling VT more often rather than less, so something is a little off for sure. /cc @daxian-dbw\r\n\r\n\r\n\r\n### Expected behavior\r\n\r\n```console\r\nfoo\r\n```\r\n\r\nwith `f` inverted, to highlight the matching part of the line.\r\n\r\n\r\n### Actual behavior\r\n\r\n```console\r\n←[7mf←[0moo\r\n```\r\n\r\nThat is, the VT escape sequence weren't rendered.\r\n\r\n### Error details\r\n\r\n_No response_\r\n\r\n### Environment data\r\n\r\n```powershell\r\nPowerShell 7.4.0 on Windows 11 22H2\r\n```\r\n\r\n\r\n### Visuals\r\n\r\n_No response_","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2023-12-11T19:27:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/20898/PowerShell/issues/20898"}
| 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:e8e347f1-19aa-3145-6488-d8d58366f3a7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9876:2B0738:A99B5B:E5DBC1:6A5319F7 |
| html-safe-nonce | 5a723343ab4a4649fc3a101e2452c2e947ff6d3dee43f80c5db3d8556d6d4c7a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5ODc2OjJCMDczODpBOTlCNUI6RTVEQkMxOjZBNTMxOUY3IiwidmlzaXRvcl9pZCI6IjE2NDcyODQwODMzODUxMTMwNzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 469dd64ef6943ade9b0fee78f3e354fa068fb48a7fd7edf492ba5c17ec65d9c3 |
| hovercard-subject-tag | issue:2036380303 |
| 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/20898/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8ad7f4e4ccf3b1bdad2e4d1d1948c622eed5f166a457c0264c28898d60616e38/PowerShell/PowerShell/issues/20898 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8ad7f4e4ccf3b1bdad2e4d1d1948c622eed5f166a457c0264c28898d60616e38/PowerShell/PowerShell/issues/20898 |
| 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 | mklement0 |
| 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