@@ -56,11 +56,9 @@ var binaries = {
56
56
var urlPrefix = 'https://selenium.googlecode.com/files/IEDriverServer' ;
57
57
if ( os . type ( ) == 'Windows_NT' ) {
58
58
if ( os . arch ( ) == 'x64' ) {
59
- binaries . iedriver . url = urlPrefix + '_x64_' + versions . iedriver +
60
- '.zip' ;
59
+ return urlPrefix + '_x64_' + versions . iedriver + '.zip' ;
61
60
} else {
62
- binaries . iedriver . url = urlPrefix + '_win32_' + versions . iedriver +
63
- '.zip' ;
61
+ return urlPrefix + '_win32_' + versions . iedriver + '.zip' ;
64
62
}
65
63
}
66
64
}
@@ -125,6 +123,18 @@ var httpGetFile = function(fileUrl, fileName, outputDir, callback) {
125
123
} ) ;
126
124
} ;
127
125
126
+ /**
127
+ * Normalize a command across OS
128
+ */
129
+ var spawnCommand = function ( command , args ) {
130
+ var win32 = process . platform === 'win32' ;
131
+ var winCommand = win32 ? 'cmd' : command ;
132
+ var finalArgs = win32 ? [ '/c' ] . concat ( command , args ) : args ;
133
+
134
+ return require ( 'child_process' ) . spawn ( winCommand , finalArgs ,
135
+ { stdio : 'inherit' } ) ;
136
+ } ;
137
+
128
138
/**
129
139
* If a new version of the file with the given url exists, download and
130
140
* delete the old version.
@@ -197,8 +207,7 @@ switch (argv._[0]) {
197
207
args . push ( '-Dwebdriver.ie.driver=' +
198
208
path . join ( argv . out_dir , executableName ( 'IEDriverServer' ) ) ) ;
199
209
}
200
- var javaChild = require ( 'child_process' ) . spawn (
201
- 'java' , args , { stdio : 'inherit' } ) ;
210
+ spawnCommand ( 'java' , args ) ;
202
211
break ;
203
212
case 'status' :
204
213
for ( name in binaries ) {
@@ -232,6 +241,7 @@ switch (argv._[0]) {
232
241
if ( argv . ie ) {
233
242
downloadIfNew ( binaries . ie , argv . out_dir , existingFiles ,
234
243
function ( filename ) {
244
+ var zip = new AdmZip ( filename ) ;
235
245
// Expected contents of the zip:
236
246
// IEDriverServer.exe
237
247
zip . extractAllTo ( argv . out_dir ) ;
0 commit comments