Permalink
Browse files

emit a close event for the raw example

  • Loading branch information...
1 parent 4197bc6 commit a0f2f97ac07aa01cbb100deb706e7cc39dd6ae62 @substack committed Aug 8, 2013
Showing with 3 additions and 2 deletions.
  1. +2 −2 example/raw.js
  2. +1 −0 index.js
View
@@ -9,11 +9,11 @@ var sh = bash({
read: fs.createReadStream,
exists: fs.exists
});
+sh.on('close', process.exit);
process.stdin.on('data', function (buf) {
- if (buf[0] === 3) process.exit();
if (buf[0] === 13) process.stdout.write('\n');
- else if (buf[0] > 27 || buf[0] === 13) {
+ else if (buf[0] > 27 && buf[0] < 127) {
process.stdout.write(buf);
}
});
View
@@ -322,6 +322,7 @@ Bash.prototype.createStream = function () {
function end () {
closed = true;
output.queue(null);
+ self.emit('close');
}
};

0 comments on commit a0f2f97

Please sign in to comment.