Here's what you want:
c.on('ready', function() {
c.exec('ls -lah', function(err, stream) {
if (err)
throw err; // Do something more sensible than this
stream.on('data', function(data) {
console.log('STDOUT: ' + data);
});
stream.stderr.on('data', function(data) {
console.log('STDERR: ' + data);
});
stream.on('close', function(code, signal) {
console.log('Process closed with code ' + code);
});
});
});