Switch-Process, when used to replace the PowerShell process with an interactive (different) shell session, breaks that session
See original GitHub issuePrerequisites
- 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 reproduce
Clearly not a common use case, but a bug nonetheless:
When you use Switch-Process
(exec
) to replace the current PowerShell process (running an interactive session) with a different shell’s interactive session (e.g., bash
), that session’s command-line editing is broken.
# Run on macOS or Linux
Switch-Process /bin/bash
Expected behavior
A regular interactive Bash session.
Actual behavior
What the user types on the Bash command line doesn’t print (however, submitting commands and printing output works normally).
Error details
No response
Environment data
PowerShell Core 7.3.0-rc.1 on macOS 12.6 or Linux
Visuals
No response
Issue Analytics
- State:
- Created a year ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
about Remote Disconnected Sessions - PowerShell
Explains how to disconnect and reconnect to a PowerShell Session (PSSession).
Read more >Exit-PSSession (Microsoft.PowerShell.Core)
The Exit-PSSession cmdlet ends interactive sessions that you started by using the Enter-PSSession cmdlet. You can also use the exit keyword to end...
Read more >Enter-PSHostProcess (Microsoft.PowerShell.Core)
The Enter-PSHostProcess cmdlet connects to and enters into an interactive session with a local process. Beginning in PowerShell 6.2, this cmdlet is ...
Read more >Resolving PowerShell module assembly dependency ...
This presents issues when a module's dependencies conflict with already-loaded DLLs and may prevent using two otherwise unrelated modules in the ...
Read more >Differences between Windows PowerShell 5.1 and ...
This article summarizes the differences and breaking changes from Windows PowerShell 5.1 and the current version of PowerShell that is based ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Instead of PowerShell, It could be what .NET does, or more specifically, what
[Console]::Readkey
does. The following is quoted from the blog about “Console.ReadKey” improvement:I’m guessing that
fish
,zsh
, etc… is explicitly setting stty to echo whereas older shells do not. Don’t understand what other shells are doing to make it work. Here’s something that’s a bit interesting:So interactive mode for PowerShell is doing something affecting the tty.