From d7643175269a6bca2df9955284e4183f8c3f9a65 Mon Sep 17 00:00:00 2001 From: Graeme Pyle Date: Mon, 9 Mar 2015 08:37:02 +0200 Subject: [PATCH 1/4] Fixed bug where script wouldn't run if first command was send* --- lib/nexpect.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/nexpect.js b/lib/nexpect.js index bba5086..cab811e 100644 --- a/lib/nexpect.js +++ b/lib/nexpect.js @@ -301,7 +301,11 @@ function chain (context) { return; } - callback(null, stdout, signal || code); + callback(null, stdout, signal || code); + }); + + setTimeout(function() { + evalContext(); }); return context.process; From 9aea4a2c2ff05cdad1780654ff04b4fbe1414833 Mon Sep 17 00:00:00 2001 From: Graeme Pyle Date: Mon, 9 Mar 2015 08:37:31 +0200 Subject: [PATCH 2/4] Ignore WebStorm stuff --- .gitignore | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2f6141d..b5afa97 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,52 @@ node_modules npm-debug.log -.DS_Store \ No newline at end of file +.DS_Store +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm + +*.iml + +## Directory-based project format: +.idea/ +# if you remove the above rule, at least ignore the following: + +# User-specific stuff: +# .idea/workspace.xml +# .idea/tasks.xml +# .idea/dictionaries + +# Sensitive or high-churn files: +# .idea/dataSources.ids +# .idea/dataSources.xml +# .idea/sqlDataSources.xml +# .idea/dynamic.xml +# .idea/uiDesigner.xml + +# Gradle: +# .idea/gradle.xml +# .idea/libraries + +# Mongo Explorer plugin: +# .idea/mongoSettings.xml + +## File-based project format: +*.ipr +*.iws + +## Plugin-specific files: + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties + + From f1d5cea42c6c1664ffe2065b22cd5954715494fe Mon Sep 17 00:00:00 2001 From: Graeme Pyle Date: Mon, 9 Mar 2015 08:40:29 +0200 Subject: [PATCH 3/4] Spacing --- lib/nexpect.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nexpect.js b/lib/nexpect.js index cab811e..5a65510 100644 --- a/lib/nexpect.js +++ b/lib/nexpect.js @@ -301,7 +301,7 @@ function chain (context) { return; } - callback(null, stdout, signal || code); + callback(null, stdout, signal || code); }); setTimeout(function() { From 300c5cf51d2a47a8a7a3db5f46507112fb5a3339 Mon Sep 17 00:00:00 2001 From: Graeme Pyle Date: Thu, 19 Mar 2015 10:02:07 +0200 Subject: [PATCH 4/4] Somehow [0] on empty context.queue gets args, so check for empty queue first --- lib/nexpect.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/nexpect.js b/lib/nexpect.js index 5a65510..d35bb33 100644 --- a/lib/nexpect.js +++ b/lib/nexpect.js @@ -127,7 +127,11 @@ function chain (context) { // function run had `name`. // function evalContext (data, name) { - var currentFn = context.queue[0]; + + var currentFn; + + if (context.queue.length > 0) + currentFn = context.queue[0]; if (!currentFn || (name === '_expect' && currentFn.name === '_expect')) { //