steelbrain / node-ssh

SSH2 with Promises
MIT License
948 stars 94 forks source link

Undesired timeout right after streaming command ends #392

Open killjoy2013 opened 3 years ago

killjoy2013 commented 3 years ago

Hi, Trying to use node-ssh in our project. Looks like it's exactly what we need, thanks for your effort! My code is below.

  const ssh = new NodeSSH();

  ssh
    .connect({
      host: ip,
      port: port,
      username: username,
      password: password,
      readyTimeout: 99999,

    })
    .then(() => {
      ssh.exec(myCommand, [], {
        onStdout(chunk) {
          console.log(chunk.toString('utf8'));
        }
      });
    });

It displays output chunks in streaming manner. However, right after command finishes, it prints,

TIMEOUT
Bye...

Should I set a timeout for the ssh session? How?

Regards