Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
simov committed Jan 24, 2017
1 parent e1bc011 commit bf82469
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/cli/prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@ exports.start = function (params, expect, callback) {
child.stdout.on('data', function (data) {
// console.log('> ' + data);
output += data.toString().trim().replace(/\r?\n|\r/g, '');
if (output == expected) response();

if (output == expected || expected == 'end') response();

clearTimeout(timeout);
timeout = setTimeout(function () {
response(new Error('Operation timed out!'));
}, 1500);
});

child.stderr.on('data', function (data) {
// console.log('! ' + data);
output += data.toString().trim().replace(/\r?\n|\r/g, '');

clearTimeout(timeout);
timeout = setTimeout(function () {
response(new Error(output));
}, 1000);
});

child.on('exit', function (code, signal) {
// console.log('$ ' + code + ' ' + signal);
});
Expand All @@ -45,6 +45,6 @@ exports.next = function (input, expect, callback) {
output = '';
expected = expect;
response = callback;

if (input != null) child.stdin.write(input);
}

0 comments on commit bf82469

Please sign in to comment.