WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Colors change when using the watch command within an ssh session

Open mtjohnson47 opened this issue 7 months ago • 4 comments

Windows Version

Microsoft Windows [Version 10.0.19045.5854]

WSL Version

2.4.13.0

Are you using WSL 1 or WSL 2?

  • [x] WSL 2
  • [ ] WSL 1

Kernel Version

5.15.167.4-microsoft-standard-WSL2 in WSL, 6.8.0-60-generic on the ssh'd server

Distro Version

22.04 in WSL, 24.04 on the ssh'd server

Other Software

In WSL: watch from procps-ng 3.3.17 On the ssh'd server: watch from procps-ng 4.0.4

Repro Steps

  1. Setup or otherwise gain access to an Ubuntu server.
  2. Open Ubuntu WSL from the Microsoft store.
  3. Run the command ssh user@address
  4. Run the command watch date
  5. Type Ctrl-C. The terminal color shades should now be different.
  6. Type Ctrl-D to return to WSL. Note that the changed colors continue to be used.

Expected Behavior

Terminal colors should not change as a result of running commands on remote servers.

Actual Behavior

The colors changed in saturation, as shown here: https://youtu.be/5yBf6TcYMwE

Diagnostic Logs

WslLogs-2025-05-25_12-26-34.zip

mtjohnson47 avatar May 25 '25 17:05 mtjohnson47

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The script will output the path of the log file once done.

If this is a networking issue, please use collect-networking-logs.ps1, following the instructions here

Once completed please upload the output files to this Github issue.

Click here for more info on logging If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

github-actions[bot] avatar May 25 '25 17:05 github-actions[bot]

Diagnostic information
Issue was edited and new log file was found: https://github.com/user-attachments/files/20432028/WslLogs-2025-05-25_12-26-34.zip
Detected appx version: 2.4.13.0

github-actions[bot] avatar May 25 '25 17:05 github-actions[bot]

Diagnostic information
Detected appx version: 2.4.13.0

github-actions[bot] avatar May 25 '25 17:05 github-actions[bot]

@mtjohnson47: WSL doesn't directly control the colors in the terminal, those are set by the programs you run. In this specific case I'm going to guess that the ctrl-c kills a program before it has time to restore the terminal colors.

You can dig deeper by running the programs causing this under strace if you want to see which one is not resetting the terminal.

Closing since this is not a WSL issue.

OneBlue avatar May 27 '25 21:05 OneBlue