sanketbajoria / ssh2-promise

ssh with promise/async await and typescript support
https://www.npmjs.com/package/ssh2-promise
MIT License
148 stars 24 forks source link

ssh.exe does not resolve on Ubuntu 18.04 nodejs v8.10.0 #46

Closed goflatworld closed 4 years ago

goflatworld commented 4 years ago

Below code works. It returns the username. But it does not close the SSH session. I have to manually stop it. I tried other Linux command. None of them resolve...

  `var SSH = require('ssh2-promise');

    var sshconfig = {
    host: 'x.x.x.x'
    username: 'yyyyy',
    privateKey: '-----BEGIN RSA PRIVATE KEY-----'};``
    var ssh= new SSH(sshconfig);
    (async function(){
        var data = await ssh.exec('whoami');
        console.log(data); //ubuntu
    })();`
sanketbajoria commented 4 years ago

Can you please add await ssh.close()

It will close all connection