While the former hands off control to streams, there are more direct issues with commands like "rmdir" (just an example which happened to me...).
I have written an SFTP server with NodeJs/SSH2. I use SSH2Promises to, say, remove a directory. Yes, it was a bug that the server crashed when I was trying to do that. But there are other circumstances which could lead to disconnection during operations. The problem here is, that the promise that's returned from sftp.rmdir(directory) is never resolved or rejected when this happens.
Now I could try to listen for 'ssh' events again and continue somehow (have another promise and use Promise.race) - but this would still keep the original promise pending for ever.
This may sound similar to https://github.com/sanketbajoria/ssh2-promise/issues/27, but it's not.
While the former hands off control to streams, there are more direct issues with commands like "rmdir" (just an example which happened to me...).
I have written an SFTP server with NodeJs/SSH2. I use SSH2Promises to, say, remove a directory. Yes, it was a bug that the server crashed when I was trying to do that. But there are other circumstances which could lead to disconnection during operations. The problem here is, that the promise that's returned from
sftp.rmdir(directory)
is never resolved or rejected when this happens.Now I could try to listen for 'ssh' events again and continue somehow (have another promise and use Promise.race) - but this would still keep the original promise pending for ever.
Any idea how to "cancel" the promise?