Skip to content

Commit

Permalink
merge & version bump
Browse files Browse the repository at this point in the history
Merge pull request chjj#37 from niallo/waitpid

Report status code of child process in `term.status` property

* niallo/waitpid:
	missed test file
	adding travis
	node 0.10 compatibility
	set SA_NOCLDSTOP flag for SIGCHLD handler
	must set exit status correctly
	fixing interoperability with native child_process. also added tests
	call node/libuv's SIGCHLD handler.
	zap status property which krept in.
	demonstrate fetching exit status
	use a PID -> exit code map to avoid race conditions.
	save exit status of child via SIGCHLD handler and waitpid(3) may be race-y due to always storing latest in global. might want to use a map of some sort.

Conflicts:
	lib/pty.js
	src/unix/pty.cc
  • Loading branch information
heavyk committed Jan 12, 2015
2 parents c5447a9 + 4e0de92 commit 7b859c2
Show file tree
Hide file tree
Showing 7 changed files with 415 additions and 315 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language: node_js
node_js:
- "0.10"
- "0.8"
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ 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');
Expand Down
13 changes: 13 additions & 0 deletions lib/pty.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,19 @@ Terminal.prototype.__defineGetter__('process', function() {
return pty.process(this.fd, this.pty) || this.file;
});

Terminal.prototype.__defineGetter__('status', function() {
return pty.status(this.pid);
});

Terminal.prototype._close = function() {
this.socket.writable = false;
this.socket.readable = false;
this.write = function() {};
this.end = function() {};
this.writable = false;
this.readable = false;
};

/**
* Helpers
*/
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
"terminal"
],
"dependencies": {
"extend": "~1.2.1",
"nan": "~1.0.0"
"extend": "~2.0.0",
"nan": "~1.4.1"
},
"devDependencies": {
"mocha": "~1.16.2"
"mocha": "~2.1.0"
}
}
Loading

0 comments on commit 7b859c2

Please sign in to comment.