From e79196f9dbe2035463face6052190c8deb0f7594 Mon Sep 17 00:00:00 2001 From: David Wickman Date: Tue, 12 Jul 2016 15:37:21 -0400 Subject: [PATCH] fix: allow spaces in file path Utilizing changes proposed by @svantreeck that allow spaces in the project's path and allowing options to be passed to webdriver_update. Closes #64 Spaces in File Path --- index.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 70536ad..76b265f 100644 --- a/index.js +++ b/index.js @@ -24,7 +24,8 @@ function getProtractorDir() { } var protractor = function(options) { - var files = [], + var env = process.env, + files = [], child, args; options = options || {}; @@ -52,9 +53,12 @@ var protractor = function(options) { args.unshift(options.configFile); } - child = child_process.spawn(path.resolve(getProtractorDir() + '/protractor'+winExt), args, { + // add protractor dir to path + env.Path = env.Path + ';' + getProtractorDir(); + + child = child_process.spawn("protractor" + winExt, args, { stdio: 'inherit', - env: process.env + env: env }).on('exit', function(code) { if (child) { child.kill(); @@ -81,6 +85,11 @@ var webdriver_update = function(opts, cb) { args.push("--" + element); }); } + if (options.args) { + options.args.forEach(function(element, index, array) { + args.push(element); + }); + } } child_process.spawn(path.resolve(getProtractorDir() + '/webdriver-manager'+winExt), args, { stdio: 'inherit'