Commits
md_5 authored a7829bfaadd
361 361 | if ( !result ) |
362 362 | { |
363 363 | throw new RuntimeException( "Could not pull updates!" ); |
364 364 | } |
365 365 | |
366 366 | System.out.println( "Successfully pulled updates!" ); |
367 367 | } |
368 368 | |
369 369 | public static int runProcess(File workDir, String... command) throws Exception |
370 370 | { |
371 - | final Process ps = new ProcessBuilder( command ).directory( workDir ).start(); |
371 + | ProcessBuilder pb = new ProcessBuilder( command ); |
372 + | pb.directory( workDir ); |
373 + | pb.environment().put( "JAVA_HOME", System.getProperty( "java.home" ) ); |
374 + | |
375 + | final Process ps = pb.start(); |
372 376 | |
373 377 | new Thread( new StreamRedirector( ps.getInputStream(), System.out ) ).start(); |
374 378 | new Thread( new StreamRedirector( ps.getErrorStream(), System.err ) ).start(); |
375 379 | |
376 380 | int status = ps.waitFor(); |
377 381 | |
378 382 | if ( status != 0 ) |
379 383 | { |
380 384 | throw new RuntimeException( "Error running command, return status !=0: " + Arrays.toString( command ) ); |
381 385 | } |