**I want to kill the process of the 'trai' command without closing the putty/command prompt OR how can I run the same command in background process OR where to pass 'CTRL+C' command in this code so that it will exitthe command **
var Client = require('ssh2').Client;
var conn = new Client();
conn.on('ready', function() {
console.log('Client :: ready');
conn.exec('trai', function(err, stream) {
if (err) throw err;
stream.on('close', function(code, signal) {
console.log('Stream :: close :: code: ' + code + ', signal: ' + signal);
conn.end();
}).on('data', function(data) {
console.log('STDOUT: ' + data);
}).stderr.on('data', function(data) {
console.log('STDERR: ' + data);
});
});
}).connect({
host: '***.***.***.',
port: 22,
username: 'frylock',
password: 'frylock'
});
As I am new to NodeJS please help me if i am wrong .
via node mail
No comments:
Post a Comment