Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.exe CLI programs called from WSL don't work with input/stdin from WSL #3160

Closed
theodiefenthal opened this issue May 7, 2018 · 6 comments
Closed

Comments

@theodiefenthal
Copy link

I'm not quite sure if this is a duplicate of #2406 or any other related stdin topics, but all the issues I found seem to be rather limited in affected scope (e.g. just affecting vagrant), whereas in my case, anything related to calling an .exe from WSL seems to not work as soon as stdin is involved.

Here are two examples:

cd /c/Program\ Files/PostgreSQL/9.6/bin/
# Following works fine
psql.exe --help
# Following blocks indefinitely:
psql.exe --username=postgres -W
Passwort für Benutzer postgres:

I get a stdin, but I can't enter anything in there. Clicking ENTER does not hat any effect. Event CTRL+C doesn't kill the process. I have to close the opened WSL.exe terminal and reopen it in order to issue any more commands.

Same goes for a docker-compose I just wanted to run (Which is not a password stdin prompt, but just a standard stdin prompt):

export PATH="$HOME/bin:$HOME/.local/bin:$PATH"
export PATH="$PATH:/mnt/c/Program\ Files/Docker/Docker/resources/bin"
git clone https://github.com/influxdata/TICK-docker.git
cd TICK-docker/1.3
# Following works and starts the database InfluxDB:
docker-compose.exe up -d
# Following will again get stall, as influxdb-cli is a CLI program which expects the user to produce some input followed by ENTER to issue commands. 
docker-compose.exe run influxdb-cli -precision rfc3339

The expected behavior: I can interoperate with .exe files the same way in WSL.exe as I can from PowerShell, i.e. I can write characters from my keyboard and press ENTER.
What's actually happening: I can not enter anything. I just have a blinking cursor any any key I press doesn't have any effect at all so that I have to close the window.

As mentioned in the beginning, I don't know if this is related to the "stdin" to "filehandle" and vice versa thing or not, but this limits in my point of view the possibilites with using WSL against windows executables quite a lot, so that there is a huge need for a proper solution or at least a workaround.

  • Your Windows build number: Microsoft Windows [Version 10.0.16299.371]
@therealkenc
Copy link
Collaborator

Microsoft Windows [Version 10.0.16299.371]

Likely #2370. Try Spring Creators and ping this issue if it remains unresolved.

@theodiefenthal
Copy link
Author

theodiefenthal commented May 8, 2018

I just updated to the new windows version but still have pretty much the same issue:
ver prints Microsoft Windows [Version 10.0.17134.1]

Well, it's not entirely the same.
Case 1: everything behaves the same way.
Case 2 (with docker-compose): I am now able to make keyboard inputs and see them in the console. Even ENTER works and starts a new line, but it is not caught. I am just typing and the CLI is not doing anything with my input.... So it is not catching up properly with my ENTER key?!
grafik
whereas in PowerShell I get:
grafik

So it even prints out a bit more to stdout which is not shown in my WSL.exe / bash.exe (tried with both)

@therealkenc
Copy link
Collaborator

Alright. You'll need a repro for this to have a fighting chance tho.

@theodiefenthal
Copy link
Author

theodiefenthal commented May 8, 2018

As I already wrote, execute in WSL.exe or bash.exe the following:

export PATH="$HOME/bin:$HOME/.local/bin:$PATH"
export PATH="$PATH:/mnt/c/Program\ Files/Docker/Docker/resources/bin"
git clone https://github.com/influxdata/TICK-docker.git
cd TICK-docker/1.3
# Following works and starts the database InfluxDB:
docker-compose.exe up -d
# Following will again get stall, as influxdb-cli is a CLI program which expects the user to produce some input followed by ENTER to issue commands. 
docker-compose.exe run influxdb-cli -precision rfc3339

Assuming that git and Docker for Windows is installed. Once the docker-compose.exe up -d was settled, you can also open PowerShell and do docker-compose.exe run influxdb-cli -precision rfc3339 to demonstrate that this is working.

For the easier reproduction of case 1, you just need to make sure that postgres (9.6) for windows is installed and can follow the steps from my initial post.

@benhillis
Copy link
Member

@theodiefenthal - I'm not able to reproduce this locally. You'll need version 17618 or later. Marking as a duplicate of #2370.

ben@BENHILL-X1:/mnt/c/Program Files/PostgreSQL/9.6/bin$ ./psql.exe --username=postgres -W
Password for user postgres:
psql (9.6.9)
WARNING: Console code page (437) differs from Windows code page (1252)
         8-bit characters might not work correctly. See psql reference
         page "Notes for Windows users" for details.
Type "help" for help.

postgres=# help
You are using psql, the command-line interface to PostgreSQL.
Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

@theodiefenthal
Copy link
Author

Does it mean that I'll have to wait half a year now for the next major windows 10 upgrade in order to test? Or is there another way to upgrade the version? Sadly, I can't agree to the insider preview program terms and conditions on my work machine..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants