Skip to content

Commit

Permalink
Fixed run callback to preserve API compatibility
Browse files Browse the repository at this point in the history
Callback parameters should be `(err, stdout, exitcode)`. The change introduced
by commit 587f600 was breaking API and also all unit-tests.

Updated README.md to show the callback parameters.
  • Loading branch information
Miroslav Bajtos committed Aug 27, 2013
1 parent 5c78aed commit 5d4534b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -41,7 +41,7 @@ Lets take a look at some sample usage:

nexpect.spawn("echo", ["hello"])
.expect("hello")
.run(function (err) {
.run(function (err, stdout, exitcode) {
if (!err) {
console.log("hello was echoed");
}
Expand Down Expand Up @@ -90,4 +90,4 @@ All tests are written with [vows][4]:
[4]: http://vowsjs.org
[5]: http://github.com/tmpvar
[6]: http://github.com/marak
[7]: http://github.com/indexzero
[7]: http://github.com/indexzero
2 changes: 1 addition & 1 deletion lib/nexpect.js
Expand Up @@ -279,7 +279,7 @@ function chain (context) {
return;
}

callback(null, code, stdout);
callback(null, stdout, code);
});

return context.process;
Expand Down
2 changes: 1 addition & 1 deletion test/nexpect-test.js
Expand Up @@ -97,4 +97,4 @@ vows.describe('nexpect').addBatch({
)
}
}
}).export(module);
}).export(module);

0 comments on commit 5d4534b

Please sign in to comment.