-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Intermittent EIO error when using a PTY process #6
Comments
You need a user session in order to use this module. This is for security reasons. You could override this to allow without a session, but I do not recommend it.
An Just a note on passing arguments to your commands: https://github.com/os-js/osjs-proc-provider#passing-arguments |
I get this error without using send method. and Exited log is shown after error. It means before exiting process i get this error. customProc.pty('ls').then(p => {
// Process events
p.on('data', str => console.log(str));
p.on('exit', () => console.log('EXITED'));
p.on('error', error => console.error(error)); // Spawn errors
// Send data to the shell
// p.send('Hello World\n');
// You can kill long running processes
// p.kill();
}); |
Can you show me an example where you're using this ? |
I have the same problem. export default function App() {
useEffect(() => {
getFolderList();
}, []);
function getFolderList(){
osjs.make('osjs/proc')
.pty('ls' , '-d */')
.then(p => {
// Process events
p.on('data', data =>{
// do something
})
p.on('exit', code => console.info('EXITED', code))
// Internal events
p.on('spawned', () => {}); // Spawn successful
p.on('error', error => console.error(error)); // Spawn errors
//p.send('Hello World\n');
// You can kill long running processes
p.kill();
})
} |
I think the problem here is that you immediately kill the PTY after it was created. This probably closes the socket before the Use |
Which means that if you remove the Also, expanding on what I said in an earlier comment about arguments, you should do this:
translates to: |
I guess I should update the wording here. Might not be immediately obvious that method is meant for manually killing a process instead of waiting for it to close by itself or that the process does not close without a signal (like a command prompt or something with a loop in it).Hence the "long running" in that comment. |
Thanks a lot. |
Great! |
I tested this code on the file manager context menu. |
And ? |
....and without killing process, sometimes I get |
Since it's intermittent it has to be some kind of race condition on the server end. Do you still get the output Also, try using |
Yes, almost always i get
I tested command with |
If it's not definitively always, then we do have some sort of racing condition going on here. As I mentioned in an earlier comment, the So I guess I have to do some testing on my own to reproduce this. Just to make sure I have the same setup, what node version are you running ? |
node v12.18.0 |
I can confirm the same issue on latest node v14. So I'll look for a fix. |
Update: I only get this on PTY however. |
Yes, only |
Oh. I now realize I read your comment wrong! It seems that this is a problem with node-pty though and not something I really can fix on my end 🤔
There's mention of a workaround, but it would have to be added by the developer using this feature, sadly. I'll re-open this issue and do some deeper investegation when I have some more time to spare. |
but my host was ubuntu! 🤔 |
The distro does not matter it seems. I get the same on Arch and Gentoo as well with the node-pty library. |
Hi,
I wrote below code, and sometimes I have some issues:
Object { errno: "EIO", code: "EIO", syscall: "read" }
The text was updated successfully, but these errors were encountered: