Permalink
Browse files

removed input.{pause,resume}(), some tests passing

  • Loading branch information...
substack committed Aug 8, 2013
1 parent ca545fa commit b0e6b5f754f708c67f88412d114130e520204006
Showing with 9 additions and 6 deletions.
  1. +9 −6 index.js
View
@@ -255,7 +255,9 @@ Bash.prototype.createStream = function () {
function inputEnd () {
if (line.length) this.queue(line);
- this.queue(null);
+ nextTick(function () {
+ input.queue(null);
+ });
}
var closed = false;
@@ -302,15 +304,13 @@ Bash.prototype.createStream = function () {
}
current = p;
- input.pause();
p.pause();
p.pipe(through(null, function () { p.emit('exit', 0) }));
var exitCode = null;
p.on('exit', function (code) {
if (exitCode !== null) return;
exitCode = code;
- input.resume();
current = null;
nextTick(function () {
if (!closed) output.queue(self.getPrompt());
@@ -322,9 +322,12 @@ Bash.prototype.createStream = function () {
function end () {
if (closed) return;
- closed = true;
- output.queue(null);
- self.emit('exit', 0);
+ if (!current) {
+ closed = true;
+ output.queue(null);
+ self.emit('exit', 0);
+ }
+ else current.on('exit', end);
}
};

0 comments on commit b0e6b5f

Please sign in to comment.