Navigation Menu

Skip to content

Commit

Permalink
Run commands actually with delay
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 6, 2012
1 parent 2e5884b commit 99d2f33
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions test/test-utils.js
Expand Up @@ -158,21 +158,23 @@ function run() {
var deferred = new Deferred();
var options = Array.prototype.slice.call(arguments, 0)

var commandName = options.shift();
var commandPath = __dirname + '/../bin/' + commandName;
var command = spawn(commandPath, options);
var output = {
stdout: '',
stderr: ''
};
command.stdout.on('data', function(data) {
output.stdout += data;
});
command.stderr.on('data', function(data) {
output.stderr += data;
});
command.on('exit', function(code) {
deferred.call({ code: code, output: output });
Deferred.next(function() {
var commandName = options.shift();
var commandPath = __dirname + '/../bin/' + commandName;
var command = spawn(commandPath, options);
var output = {
stdout: '',
stderr: ''
};
command.stdout.on('data', function(data) {
output.stdout += data;
});
command.stderr.on('data', function(data) {
output.stderr += data;
});
command.on('exit', function(code) {
deferred.call({ code: code, output: output });
});
});

return deferred;
Expand Down

0 comments on commit 99d2f33

Please sign in to comment.