1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
package org.openslx.satserver.util; import java.io.File; import java.io.IOException; public class Exec { public static int sync( String... command ) { ProcessBuilder pb = new ProcessBuilder( command ); pb.directory( new File( "/" ) ); Process p; try { p = pb.start(); return p.waitFor(); } catch ( IOException | InterruptedException e ) { return -1; } } }