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
-cmd and stdin (mac / linux) #4669
Comments
For what it's worth this works fine for me on Windows. |
Thanks, @Simn. I tested mac and it's also broken there. I'll update the bug description. |
I can reproduce the problem on Linux. |
Does it works after you hit enter? |
No. |
Uhm, that seems normal: we're using Unix.open_process_full in main.ml/run_command and are not redirecting our stdin to the process stdin. We instead need to create new pout/perr pipes and use create_process, as shown is I'll leave @Simn to implement + test on Windows/Linux |
It's pretty awkward for me to test this through my Ubuntu VM. Maybe @waneck could help out here? |
I could potentially validate a change on Ubuntu. You could send me a branch, patch, or updated main.ml. |
Note the change in test.hxml. "-x TestClient" cannot be used when Sys.stdin() is in the source code as -x utilizes the -cmd internally. -cmd does not work with Sys.stdin() (see HaxeFoundation/haxe#4669). Use 'haxe test.hxml && neko TestClient.n' as a testing one-liner.
When using
-cmd
in an hxml file, it doesn't appear that STDIN is being redirected properly -- the program does not respond to user input.This may be an hxcpp or haxelib problem, not sure. Perhaps related to #3859 (a different issue, but similar regarding i/o in
-cmd
mode), except that's neko/output and this is hxcpp/input. But I assume stdout redirection should affect all runtimes?Here's a testcase, a simple CLI:
build.hxml
Main.hx (note, neither readByte nor getChar work)
Expected behavior: hitting keys should print keycodes, q should exit.
Observed behavior: hitting keys does nothing, ctrl-c is required to exit.
I tested both hxcpp and neko on linux and mac, both exhibit the problem. Simon tested windows and didn't see the issue.
If you launch the program standalone, it works as expected. Just not when launched via
-cmd
The text was updated successfully, but these errors were encountered: