Wait on the process to close so it doesn't crash and restart

Former-commit-id: cdc3142df1
Former-commit-id: 18bb29422f69ad9de58642959f01879ec6aa3e8b
This commit is contained in:
idk
2022-08-07 22:55:35 -04:00
parent 3dded34f5d
commit 2a52eecf0b
2 changed files with 5 additions and 3 deletions

View File

@ -366,15 +366,17 @@ public class I2PFirefox {
}
if (waitForProxy()){
ProcessBuilder pb = this.defaultProcessBuilder();
Process p = null;
try{
System.out.println(pb.command());
pb.start();
p = pb.start();
}catch(Exception e){
System.out.println("Error: "+e.getMessage());
}finally{
System.out.println("I2PFirefox");
try{
pb.wait();
System.out.println("Waiting for I2PFirefox to close...");
p.waitFor();
}catch(Exception e){
System.out.println("Error: "+e.getMessage());
}