mikeal / sequest

Simplified API for SSH and SFTP similar to request.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hide Output when using callbacks

woverton opened this issue · comments

Why does this code print out the output to the screen?

NodeBuilder.prototype.runSshCommand = function(ip, user, command, callback) {
    sequest('user@' + ip, {
        command: command,
        privateKey: this.awsKey
    }, function(err, stdout) {
        if (err) {
            callback(err);
            return;
        }
        callback(null, null);
    })
}

NodeBuilder.prototype.doTheTheThing = function(callback){
    this.runSshCommand("xxx.xxx.xxx.xxx", "(echo n; echo p; echo 2; echo ; echo ; echo w) | fdisk /dev/sdb2", function(err, data) {
        callback(err, null);
    });
}