Skip to content

Commit

Permalink
Refactor to use spawn
Browse files Browse the repository at this point in the history
Fixes #3
  • Loading branch information
digitalsadhu committed Aug 20, 2015
1 parent 1c95e41 commit 1d257f9
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,12 @@ program.command('* [params...]')
}

//run the command
cp.exec(sshCommand, function (err, stdout, stderr) {
if (err) {
console.error(err.message)
process.exit()
}

console.log(stdout)
console.log(stderr)
})
var arguments = sshCommand.split(' ')
var cmd = arguments.shift()

var dt = cp.spawn(cmd, arguments)
dt.stdout.pipe(process.stdout)
dt.stderr.pipe(process.stderr)
})
})

Expand Down

0 comments on commit 1d257f9

Please sign in to comment.