Comments (4)
That behaviour is caused by the Windows Console. For other programs (e.g. tasklist
), I noticed that a workaround is to launch wcmd echo.
before (actually anything that launches cmd and makes it outputs something on the console, echo.
being command producing the less output I could think of). Can you give it a try?
I think I'll make that be launched automatically at the beginning of each session. I would prefer to find the equivalent Win32 calls that fix everything, but the win32 calls tracing feature of windbg is actually broken in Win10 (how do MS devs debug their stuff with broken tools?!?) and I had no more luck with other 3rd party tools, so I think I'll just go with launching wcmd echo.
from cbwin.
With tmux running wrun vagrant provision
with ansible output seems normal to me
from cbwin.
I'm using a wrapper script to play nice with the rest of the tooling. So far, tried two solutions that work:
#!/bin/sh
wcmd echo. > \\\\.\\NUL
wrun vagrant $@
exit $?
^ basically @xilun's solution, but redirected to the NUL device (i.e Windows's equivalent for /dev/null) to avoid printing an extra line
After bit of RTFM'ing, I've settled for:
#!/bin/sh
wrun --force-redirects vagrant $@
exit $?
from cbwin.
Some technical details: cmd.exe changes the Console modes (probably as with SetConsoleMode) and cbwin doesn't touch it (except in an experimental branch).
Unfortunately changing console modes back and forth seems to not be enough in Win10 1607 to get the console input working properly when both WSL and Win32 processes are running -- however something probably good enough can be achieved for the output.
The --force-redirects prevents the Win32 process from accessing the console at all (well, if it really wants to, it can reopen it, but most Win32 program won't do that...), because it redirects stdin, out and err to TCP sockets to the WSL side, where the launcher copy the data from/to its own TTY fds.
One of the drawback of how I implemented redirections is that it breaks flow control a little on stdin, because even if the Win32 process would never have read any data, the WSL caller will read and send any stdin data through the socket, until its buffer are full. I can't do much about that, but I think MS interop (for now in Insider versions only) can directly bridge a WSL pipe end to Win32 pipe end, so hopefully that kind of imperfect behaviour will be avoided with native MS interop.
from cbwin.
Related Issues (20)
- wrun: can't translate a WSL VolFs path to a Win32 one HOT 7
- Default command handler HOT 10
- some win32 console programs "sometimes" do line feed instead of new line, but a workaround seems possible HOT 1
- a cmd-like behavior distinguishing between console / GUI target programs might be useful HOT 1
- backgrounded & force redirected caller => SIGTTIN
- Use double quotes to prevent word splitting may be better HOT 12
- Problem with arguments containing the character "&" HOT 1
- wcmd cmd no longer laggy, but eats characters HOT 1
- Let cbwin in session mode launch multiple wcmd instances in parallel HOT 11
- sockets for redirections are not using any security HOT 6
- wstart /mnt/c/windows does not work HOT 7
- Not work inside zsh HOT 14
- behavior of environment variable inconsistent in regards to case sensitivity HOT 1
- No terminal support HOT 6
- interactive win32 console programs are broken (input and output) HOT 5
- Native Windows support for launching Windows applications HOT 1
- Some inputted characters skipped in Docker interactive terminal HOT 1
- Starting parameters for bash.exe
- Can't remove cbwin from my pc HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cbwin.