microsoft / node-pty

Fork pseudoterminals in Node.JS
Other
1.46k stars 236 forks source link

Xterm and node-pty input problem #453

Closed erhalv closed 2 years ago

erhalv commented 3 years ago

Environment details

Issue description

I'm not able to send data to the process that only listens for input (does not send data). Spawning a python file with this code creates the issue: input("") With a python file like this it works: input("Hello")

I'm spawning the python file like this: const ptyProcess = pty.spawn(path.join(process.cwd(), "./python/python.exe"),["./test.py"] The same issue occur when spawning a similar program written in C#.

I'm using the electron example provided in this repository (if you want to replicate this issue).

Tyriar commented 3 years ago

Not sure I'm understanding the problem? Maybe a screenshot would help?

erhalv commented 3 years ago

The issue seems to be that I'm not able to write to the pty process if it hasn't sent any data. This is the changes i made to the electron example: image

ptyProcess.write works when test.py contains:

input("test")

or

print("test")
input()

but does not work if test.py contains

input("")
jerch commented 3 years ago

Cannot repro this under linux. Is this a windows only issue by any chance?

Tyriar commented 3 years ago

@jerch it's Windows, I see python.exe

bryphe commented 3 years ago

It's possible this is the same issue @Eugeny encountered in #457 and fixed in #460 , if using node version 14+