Powershell subscript causes tmux display issues #81

Closed
opened 2026-01-30 21:41:41 +00:00 by claunia · 2 comments
Owner

Originally created by @bitcrazed on GitHub (Feb 16, 2018).

From @serrearthur on December 7, 2017 21:35

When executing a powershell.exe script inside a tmux session, this will mess the display until the tmux session is closed.

capture
On this picture, the left pane should be filled with text from the output of ls -al, and the right panes are missing part of their borders.

Step to reproduce :

  • Install tmux (tested with tmux 2.6)
  • Launch it (works even without .tmux.conf file)
  • Create a new vertical pane : tmux split-window -h
  • Launch a powershell.exe command : powershell.exe -Help | less
    This will mess up your display : it hides parts of your screen, will not update some data, will copy some text all over your screen, ...

Cases tested :

  • Reproduced with both bash and zsh
  • Reproduced even when redirecting the output of powershell : powershell.exe -Help &>/dev/null
  • Reproduced with various powershell flags : powershell.exe -NoLogo -NoProfile -NonInteractive -OutputFormat Text -Help &>/dev/null
  • Reproduced even without doing tmux split-window -h. However, there are only a few graphical bugs in this case. Spliting the window makes the problem clearer.
  • Windows version : 10.0.17046.1000

Is this a bug ? Is there a workaround ?


Just as a side note, the reason I wanted to execute powershell commands is because I want to retreive the status of NUM_LOCK and CAPS_LOCK, and xset q always return false on WSL. Instead, I used powershell.exe "[console]::NumberLock" and powershell.exe "[console]::CapsLock" to get the real status.

Copied from original issue: Microsoft/WSL#2731

Originally created by @bitcrazed on GitHub (Feb 16, 2018). _From @serrearthur on December 7, 2017 21:35_ When executing a `powershell.exe` script inside a tmux session, this will mess the display until the tmux session is closed. ![capture](https://user-images.githubusercontent.com/4455328/33739467-7b0ce5c6-db9d-11e7-93c6-9aa5b1d2199c.PNG) On this picture, the left pane should be filled with text from the output of `ls -al`, and the right panes are missing part of their borders. Step to reproduce : - Install `tmux` (tested with `tmux 2.6`) - Launch it (works even without `.tmux.conf` file) - Create a new vertical pane : `tmux split-window -h` - Launch a powershell.exe command : `powershell.exe -Help | less` This will mess up your display : it hides parts of your screen, will not update some data, will copy some text all over your screen, ... Cases tested : - Reproduced with both `bash` and `zsh` - Reproduced even when redirecting the output of powershell : `powershell.exe -Help &>/dev/null` - Reproduced with various powershell flags : `powershell.exe -NoLogo -NoProfile -NonInteractive -OutputFormat Text -Help &>/dev/null` - Reproduced even without doing `tmux split-window -h`. However, there are only a few graphical bugs in this case. Spliting the window makes the problem clearer. - Windows version : 10.0.17046.1000 Is this a bug ? Is there a workaround ? --- Just as a side note, the reason I wanted to execute `powershell` commands is because I want to retreive the status of NUM_LOCK and CAPS_LOCK, and `xset q` always return `false` on WSL. Instead, I used `powershell.exe "[console]::NumberLock" ` and `powershell.exe "[console]::CapsLock" ` to get the real status. _Copied from original issue: Microsoft/WSL#2731_
claunia added the Product-ConhostArea-Interop labels 2026-01-30 21:41:41 +00:00
Author
Owner

@bitcrazed commented on GitHub (Feb 16, 2018):

From @zadjii-msft on December 8, 2017 17:22

I'm pretty sure this is just a side effect of how interop works - when powershell is launched, it's console handles are to the console that's running tmux, not the ptty inside of tmux. So powershell doesn't know it's inside a "pane", and treats the whole window as it woud a normal console window. At the same time, tmux is also painting to the whole buffer, and everything gets all messed up.

@benhillis can comment more if I'm wrong on any part of this.

We're trying to figure out a better solution for this problem, but I've personally kept to keeping my interop shells in their own windows in tmux, and not mixing and matching panes with them, and that seems to work better.

@bitcrazed commented on GitHub (Feb 16, 2018): _From @zadjii-msft on December 8, 2017 17:22_ I'm pretty sure this is just a side effect of how interop works - when powershell is launched, it's console handles are to the console that's running tmux, not the ptty inside of tmux. So powershell doesn't know it's inside a "pane", and treats the whole window as it woud a normal console window. At the same time, tmux is also painting to the whole buffer, and everything gets all messed up. @benhillis can comment more if I'm wrong on any part of this. We're trying to figure out a better solution for this problem, but I've personally kept to keeping my interop shells in their own windows in tmux, and not mixing and matching panes with them, and that seems to work better.
Author
Owner

@DHowett-MSFT commented on GitHub (Feb 6, 2019):

The changes to WSL interop in RS5 should have fixed this.

@DHowett-MSFT commented on GitHub (Feb 6, 2019): The changes to WSL interop in RS5 should have fixed this.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#81