From 5d4534bf0ee18fc91b9290d6c9ebcd46c5dbae4c Mon Sep 17 00:00:00 2001 From: Miroslav Bajtos Date: Tue, 27 Aug 2013 16:04:05 +0200 Subject: [PATCH] Fixed `run` callback to preserve API compatibility Callback parameters should be `(err, stdout, exitcode)`. The change introduced by commit 587f600c13f was breaking API and also all unit-tests. Updated README.md to show the callback parameters. --- README.md | 4 ++-- lib/nexpect.js | 2 +- test/nexpect-test.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2925e2f..0740bc0 100644 --- a/README.md +++ b/README.md @@ -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"); } @@ -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 \ No newline at end of file +[7]: http://github.com/indexzero diff --git a/lib/nexpect.js b/lib/nexpect.js index 5417912..5b454c2 100644 --- a/lib/nexpect.js +++ b/lib/nexpect.js @@ -279,7 +279,7 @@ function chain (context) { return; } - callback(null, code, stdout); + callback(null, stdout, code); }); return context.process; diff --git a/test/nexpect-test.js b/test/nexpect-test.js index 589e932..4ad132f 100644 --- a/test/nexpect-test.js +++ b/test/nexpect-test.js @@ -97,4 +97,4 @@ vows.describe('nexpect').addBatch({ ) } } -}).export(module); \ No newline at end of file +}).export(module);