chjj/pty.js — pull request #37 by niallo (2013-07-29 18:45:48+00:00)
Title: Report status code of child process in `term.status` property

Use `waitpid(3)` in a `SIGCHLD` handler to map the exit status to PID. This is then made available to Node via a getter.

For example:

```javascript
var pty = require('./pty.js');

var term = pty.spawn('bash', [], {
name: 'xterm-color',
cols: 80,
rows: 30,
cwd: process.env.HOME,
env: process.env
});

term.on('data', function(data) {
console.log(data);
});

term.on('close', function() {
console.log('exit status: %d', term.status);
});

term.write('ls\r');
term.resize(100, 40);
term.write('ls /\r');
term.write('exit 2\r');

console.log(term.process);
```