We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
From Stream I expect to see my string displayed because I fall in the edge case.
$ node -e " const node_pty = require('node-pty'); const pty = node_pty.spawn('bash', [ '-c', 'echo somet${nothing}hing' ]); pty.pause(); setTimeout(() => { pty._socket.on('data', console.log); pty.on('data', console.log); pty.resume(); console.log('data is lost'); }, 2000); " data is lost
I see that PipeSocket inherit from net.Socket and it mention that data is dropped if no listener:
The data will be lost if there is no listener when a Socket emits a 'data' event.
https://nodejs.org/api/net.html#event-data however this seems like it is untouched since "v0.1.90" so most likely wrong. I just opened an upstream issue to confirm.
I tried to debug and here are my findings: node-pty add a data handler with code that emulate EventEmitter (with EventEmitter2)
node-pty/src/terminal.ts
Line 96 in d6ce76a
When we strace we see the data is read by node so the data is lost between nodejs runtime and node-pty.
$ strace -f -e /write,read node -e " const node_pty = require('node-pty'); const pty = node_pty.spawn('bash', [ '-c', 'echo somet${nothing}hing' ]); pty.pause(); setTimeout(() => { pty._socket.on('data', console.log); pty.on('data', console.log); pty.resume(); console.log('data is lost'); }, 2000); " 2>&1 | grep something [pid 785556] write(1, "something\n", 10) = 10 [pid 785546] read(23, "something\r\n", 65536) = 11
(I added ${nothing} to be sure we read the output produce by bash)
${nothing}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Environment details
Issue description
From Stream I expect to see my string displayed because I fall in the edge case.
I see that PipeSocket inherit from net.Socket and it mention that data is dropped if no listener:
https://nodejs.org/api/net.html#event-data however this seems like it is untouched since "v0.1.90" so most likely wrong. I just opened an upstream issue to confirm.
I tried to debug and here are my findings:
node-pty add a data handler with code that emulate EventEmitter (with EventEmitter2)
node-pty/src/terminal.ts
Line 96 in d6ce76a
Is their a particular reason to recreate this code path with no value added (it simply forward argument) maybe a POO quircks.
When we strace we see the data is read by node so the data is lost between nodejs runtime and node-pty.
(I added
${nothing}
to be sure we read the output produce by bash)The text was updated successfully, but these errors were encountered: