Solution to the problem that the display is corrupted when the .exe command is included in the while loop in wsl2

problem

When I execute a Windows command (.exe) in a while loop of wsl2, the display is corrupted.

$ seq 10 | while read i; do ipconfig.exe &>/dev/null; echo $i; done
1

I can't get the expected result. The same applies to commands of .exe other than ʻipconfig.exe`. wsl1 does not have this problem.

Cause

(Probably) .exe is picking up the standard input.

solution

Add </ dev / null to .exe.

ipconfig.exe </dev/null
$ seq 10 | while read i; do ipconfig.exe </dev/null &>/dev/null; echo $i; done
1
2
3
4
5
6
7
8
9
10

Recommended Posts

Solution to the problem that the display is corrupted when the .exe command is included in the while loop in wsl2
A solution to the problem that the Python version in Conda cannot be changed
Solution to the problem that build does not end when installing OpenCV (PEP517)
Solution to the problem that you can't activate by putting conda in pyenv
[Python] Solution to the problem that elements are linked when copying a list
[Jinja2] Solution to the problem that variables added in the for statement are not inherited
A solution to the problem that files containing [and] are not listed in glob.glob ()
How to delete "(base)" that appears in the terminal when Anaconda is installed on Mac
[VLC] How to deal with the problem that it is not in the foreground during playback
Temporary solution to the problem that the exe file created by PyInstaller is mistaken as a Trojan horse virus by AVAST or AVG
How to deal with the problem that the current directory moves when Python is executed from Atom
To make sure that the specified key is in the specified bucket in Boto 3
Python-docx The icon is strange when saved. → Solution (changed to Python-docx → pywin32)
The solution when an empty object is returned in go's json.Marshal
Goodbye to the command prompt in WSL, VSCode and Windows Terminal
I made a command to display a colorful calendar in the terminal
What to do when the value type is ambiguous in Python?
Solution to the problem that Ctrl + z cannot be used in Powershell in Docker for windows environment (provisional)
In the python command python points to python3.8
The NVM Checksum Is Not Valid, a solution to the problem that Intel's wired LAN is not recognized on Linux
How to hide the command prompt when running python in visual studio 2015
What to do when the warning "The environment is in consistent ..." appears in the Anaconda environment
When the target is Ubuntu 16.04 in Ansible
Solution: The jedi-vim pop-up display is broken
Measures to be taken when "Cannot open display" is displayed in X11 Forward
How to display in the entire window when setting the background image with tkinter
[For beginners] Unexpected behavior if "\" is included when setting the path in Python
The problem that the system restarts without permission while learning using GPU in TensorFlow
I want to be notified when the command operation is completed on linux!
A solution to the problem that kernel restarting frequently occurs when running PyQt system with jupyter or Spyder IDE