Closed mtygesen closed 7 months ago
In other parts of the code, we use Platform.isWindows() to detect that we are running on windows. We should perhaps stick to this.
@yrke, there was a problem with mac/linux as it didn't run with the quatations, so now the changes are guarded only for windows. Does it look good to you?
At ProcessRunner.java, there is this code that disassembles the arguments to the call into a string array:
private String[] getCmdArray(){
String[] argSplit = arguments.split("\s+");
String[] cmdArray = new String[1 + argSplit.length];
cmdArray[0] = file;
System.arraycopy(argSplit, 0, cmdArray, 1, argSplit.length);
return cmdArray;
}
and the process is then executed using: process = Runtime.getRuntime().exec(getCmdArray());
So this looks little bit weird that we first create a string with all the arguments and before the call try to split it into the separate arguments again - and here if we have the spaces in arguments/switches things can go wrong.
I think that a better solution would be to make a class that will maintain the arguments as an array of strings with the method .add that will add strings to the array and then just used that array when doing Runtime.getRuntimed().exec(...).
Fixes: https://bugs.launchpad.net/tapaal/+bug/2056063