Saturday 13 May 2017

Is it possible to stream sdtout/stderr output from node-ssh exec()

Using node-ssh JS library, one can execute remote commands. Is it possible to get streamed output from a long-running command, as it is generated? (Without waiting the command to end).

The example in the project page suggests you can only get stdout and stderr once the command is done:

ssh.execCommand('hh_client --json', { cwd:'/var/www'})
.then(function(result) {
    console.log('STDOUT: ' + result.stdout)
    console.log('STDERR: ' + result.stderr)
})



via herchu

No comments:

Post a Comment