| 1 |
package processing.app.helpers; |
| 2 |
|
| 3 |
import java.io.IOException; |
| 4 |
import java.util.Map; |
| 5 |
|
| 6 |
public class ProcessUtils { |
| 7 |
|
| 8 |
public static Process exec(String[] command) throws IOException { |
| 9 |
|
| 10 |
if (!OSUtils.isWindows()) { |
| 11 |
return Runtime.getRuntime().exec(command); |
| 12 |
} |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
String[] cmdLine = new String[command.length]; |
| 20 |
for (int i = 0; i < command.length; i++) |
| 21 |
cmdLine[i] = command[i].replace("\"", "\\\""); |
| 22 |
|
| 23 |
ProcessBuilder pb = new ProcessBuilder(cmdLine); |
| 24 |
Map<String, String> env = pb.environment(); |
| 25 |
env.put("CYGWIN", "nodosfilewarning"); |
| 26 |
return pb.start(); |
| 27 |
} |
| 28 |
} |