Browse files

Add a 100ms delay to command runs in tests to ensure output/errors ar…

…e collected correctly
  • Loading branch information...
1 parent fb614f3 commit b4114726954d5ae35b1597cc6f1d820c94422fdf @gotwarlost committed Jan 3, 2013
Showing with 12 additions and 10 deletions.
  1. +12 −10 test/cli-helper.js
View
22 test/cli-helper.js
@@ -124,16 +124,18 @@ function runCommand(command, args, envVars, callback) {
process.stderr.write(data);
});
handle.on('exit', function (exitCode) {
- out = out.split(/\r?\n/);
- err = err.split(/\r?\n/);
- callback({
- succeeded: function () { return exitCode === 0; },
- exitCode: exitCode,
- stdout: function () { return out; },
- stderr: function () { return err; },
- grepOutput: grepper(out),
- grepError: grepper(err)
- });
+ setTimeout(function () {
+ out = out.split(/\r?\n/);
+ err = err.split(/\r?\n/);
+ callback({
+ succeeded: function () { return exitCode === 0; },
+ exitCode: exitCode,
+ stdout: function () { return out; },
+ stderr: function () { return err; },
+ grepOutput: grepper(out),
+ grepError: grepper(err)
+ });
+ }, 100);
});
}

0 comments on commit b411472

Please sign in to comment.