-
Notifications
You must be signed in to change notification settings - Fork 242
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
Add a callback to ptyProcess.write #651
Comments
When you write the data is fully written synchronously to the pty (you can confirm it with strace).
Line 92 in d6ce76a
Lines 176 to 178 in d6ce76a
It it not because data is written that the other process actually read it (it might be doing other thing) You might have to do with echo of the tty ? Can you provide an example where you have issue ? |
What I need is a way to tell when the TTY driver copies data back to the PTY master I guess. Basically, I don't need the echo of what the user writes to the process, but a signal when a data stream going back to the pty master has ended for the given input. Could this be possible? |
In a deleted exemple you spawned a shell and launched ls ? Why not using node:child_process or node-pty and launch directly Here in context of a shell you can know when the process ended if you detect PS1 (you can set it to a boundary string before launching ls). We can not know when the process stopped in the general case (because it might be sleeping) and signal SIGCHLD is handled by intermediary shell. |
I'm not sure to be honest. I don't think I will be able to use commands such as 'history' if I use node:child_process? |
If your intention is to read history then just fs.readFile .bash_history if shell is bash or %userprofile%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt if shell is pwsh. You will get better performance no process loading. |
Environment details
Issue description
I'm trying to send a response when ptyprocess gets data from PTY, but I'm having concurrency problem with overlapping requests. I think it would be a good option to add a callback to the .write() method with the data recieved from the socket
The text was updated successfully, but these errors were encountered: