Closed jeffrson closed 5 years ago
Well, as it looks, the stream's 'error' event is hidden inside SSH2, which is swallowed inside your sshConnection:264-268. So I have no way to resolve or reject my promises :-(
Can there be a fix?
@jeffrson Actually, once promise get resolved, we won't be able to resolve/reject it again. That's why we are emitting the error. this.emit(SSHConstants.CHANNEL.SSH, SSHConstants.STATUS.DISCONNECT, {err: err}); Please, listen for SSH event and check for disconnect status
@jeffrson Should i close this issue? Has it got resolved for you
I am closing this issue for now. Please feel free to reopen this issue, if things didn't work out for you
Sorry for the lack of response - I've been too busy.
Yes, by listening for ssh disconnect I can resolve the issue - not nice, but it works.
Hi, let's say I have this program to read an sftp stream via pure ssh2-streams:
When the server kills the connection (or the server is killed), I get "error!". This is expected.
OTOH, a similar program with SSH2Promise hangs forever when the connection will be killed:
I tried different on('error') handlers but it doesn't help. Well, btw, when I add "reconnect: false" option, the program simply exits - apparently because the event loop finishs. But without any message?!
I first thought this is a ssh2-streams bug, because ssh2-promise on the first sight only wraps createReadStream - but with pure ssh2-streams the program does not hang. Reference: https://github.com/mscdex/ssh2-streams/issues/127
Would be VERY grateful to get this solved.