mgutz/execSync — pull request #7 by ryanzec (2013-04-12 20:10:11+00:00)
Title: Add exec method that return code, stdout, and stderr with one call

Right now it is impossible to display the stderr if an attempted command does error out which can make debugging really hard. I have basically pulled the required parts of the code from https://github.com/jeremyfa/node-exec-sync and added a exec method to the returns object of execSync. This method returns an object formatted as:

```javascript
{
code: 0,
stdout: 'standard output',
stderr: 'standard error'
}
```

This method now allows me to do something like this:

```javascript
var commandResults = execSync.exec(cmd);

if(commandResults.code !== 0) {
console.log('ERROR: ' + commandResults.stderr);
} else {
console.log(commandResults.stdout);
}
```

and can properly out the standard output or the error if one occurs.