Hi Hasan,
It's unbelievable, I've faced the same issue with ProcessBuilder like you just only now:-) I don;t know why it works previously and I why it doesn't work now.
However, I started using apache commons exec for parallel running and it works like a charm:-)
So start is:
private Executor appiumProcess;
CommandLine cmdLine = new CommandLine(command);
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
ExecuteWatchdog watchdog = new ExecuteWatchdog(ExecuteWatchdog.INFINITE_TIMEOUT);
PumpStreamHandler streamHandler = new PumpStreamHandler(new FileOutputStream("Device" + deviceIndex + "Logs.txt"));
appiumProcess = new DefaultExecutor();
appiumProcess.setExitValue(0);
appiumProcess.setWatchdog(watchdog);
appiumProcess.setStreamHandler(streamHandler);
appiumProcess.execute(command, resultHandler);
Stop is simple:
appiumProcess.getWatchdog().destroyProcess();
Cmd creation smth like that:
CommandLine cmd = new CommandLine("node");
cmd.addArgument(PropertyLoader.get("appium.path"));
cmd.addArgument("-a");
cmd.addArgument(PropertyLoader.get("appium.host"));
cmd.addArgument("-p");
cmd.addArgument(String.valueOf(Integer.parseInt(PropertyLoader.get("appium.port")) + deviceIndex));
cmd.addArgument("-bp");
cmd.addArgument(String.valueOf(Integer.parseInt(PropertyLoader.get("appium.bootstrapPort")) + deviceIndex));
cmd.addArgument("-U");
cmd.addArgument(device.getUDID());