@@ -211,14 +211,13 @@ public LocalGridServer create(SeleniumConfig config, String launcherClassName, S
211211 String executable ;
212212 if (SystemUtils .IS_OS_WINDOWS ) {
213213 executable = "cmd.exe" ;
214- argsList .add (0 , pm2Binary .getName ());
214+ argsList .add (0 , pm2Binary .getAbsolutePath ());
215215 argsList .add (0 , "/c" );
216216 } else {
217- executable = pm2Binary .getName ();
217+ executable = pm2Binary .getAbsolutePath ();
218218 }
219219
220220 process = new CommandLine (executable , argsList .toArray (new String [0 ]));
221- process .setWorkingDirectory (pm2Binary .getParentFile ().getAbsolutePath ());
222221 // otherwise
223222 } else { // (running with 'node')
224223 argsList .add (0 , appiumBinaryPath );
@@ -318,16 +317,15 @@ private static File findMainScript() throws GridServerLaunchFailedException {
318317 if (SystemUtils .IS_OS_WINDOWS ) {
319318 executable = "cmd.exe" ;
320319 argsList .add ("/c" );
321- argsList .add (npm .getName ());
320+ argsList .add (npm .getAbsolutePath ());
322321 } else {
323- executable = npm .getName ();
322+ executable = npm .getAbsolutePath ();
324323 }
325324
326325 argsList .add ("root" );
327326 argsList .add ("-g" );
328327
329328 CommandLine process = new CommandLine (executable , argsList .toArray (new String [0 ]));
330- process .setWorkingDirectory (npm .getParentFile ().getAbsolutePath ());
331329
332330 try {
333331 process .execute ();
@@ -412,14 +410,13 @@ public static boolean shutdownAppiumWithPM2(URL nodeUrl) {
412410
413411 if (SystemUtils .IS_OS_WINDOWS ) {
414412 executable = "cmd.exe" ;
415- argsList .add (0 , pm2Binary .getName ());
413+ argsList .add (0 , pm2Binary .getAbsolutePath ());
416414 argsList .add (0 , "/c" );
417415 } else {
418- executable = pm2Binary .getName ();
416+ executable = pm2Binary .getAbsolutePath ();
419417 }
420418
421419 process = new CommandLine (executable , argsList .toArray (new String [0 ]));
422- process .setWorkingDirectory (pm2Binary .getParentFile ().getAbsolutePath ());
423420 process .execute ();
424421 return true ;
425422 }
0 commit comments