Skip to content

Commit e6ae55f

Browse files
authored
Merge pull request #74 from browserstack/pre_prod
Pre prod
2 parents 230ec93 + 9d17e62 commit e6ae55f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lib/Local.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
var childProcess = require('child_process'),
2+
os = require('os'),
23
fs = require('fs'),
34
path = require('path'),
45
running = require('is-running'),
@@ -7,11 +8,17 @@ var childProcess = require('child_process'),
78
psTree = require('ps-tree');
89

910
function Local(){
11+
this.sanitizePath = function(rawPath) {
12+
var doubleQuoteIfRequired = this.windows && !rawPath.match(/"[^"]+"/) ? '"' : '';
13+
return doubleQuoteIfRequired + rawPath + doubleQuoteIfRequired;
14+
};
15+
16+
this.windows = os.platform().match(/mswin|msys|mingw|cygwin|bccwin|wince|emc|win32/i);
1017
this.pid = undefined;
1118
this.isProcessRunning = false;
1219
this.retriesLeft = 5;
1320
this.key = process.env.BROWSERSTACK_ACCESS_KEY;
14-
this.logfile = path.join(process.cwd(), 'local.log');
21+
this.logfile = this.sanitizePath(path.join(process.cwd(), 'local.log'));
1522
this.opcode = 'start';
1623
this.exitCallback;
1724

@@ -124,7 +131,7 @@ function Local(){
124131
case 'folder':
125132
if(value){
126133
this.folderFlag = '-f';
127-
this.folderPath = value;
134+
this.folderPath = this.sanitizePath(value);
128135
}
129136
break;
130137

@@ -157,7 +164,7 @@ function Local(){
157164
case 'logfile':
158165
case 'logFile':
159166
if(value)
160-
this.logfile = value;
167+
this.logfile = this.sanitizePath(value);
161168
break;
162169

163170
case 'parallelRuns':
@@ -167,7 +174,7 @@ function Local(){
167174

168175
case 'binarypath':
169176
if(value)
170-
this.binaryPath = value;
177+
this.binaryPath = this.sanitizePath(value);
171178
break;
172179

173180
default:

0 commit comments

Comments
 (0)