Skip to content

Commit

Permalink
Adding prints for both system and err
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Harrington committed Jul 17, 2024
1 parent bad9639 commit 3752a7e
Showing 1 changed file with 44 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,18 +199,55 @@ public void launchApplication() {
new Thread(() -> {
try {
Process process = Runtime.getRuntime().exec(finalCommand);
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
String line;
while ((line = reader.readLine()) != null && process.isAlive()) {
System.out.println(line);
Thread thread = new Thread(()->{
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
String line;
try {
Thread.sleep(10);
} catch (InterruptedException e) {
while ((line = reader.readLine()) != null&&
process.isAlive()) {
System.err.println(line);
try {
Thread.sleep(10);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
reader.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
});
thread.start();
Thread thread2 = new Thread(()->{
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
try {
while ((line = reader.readLine()) != null&&
process.isAlive()) {
System.out.println(line);
try {
Thread.sleep(10);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
reader.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
});
thread2.start();
try {
thread2.join();
thread.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
reader.close();
System.out.println("CaDoodle Updater clean exit");
System.exit(0);
} catch (IOException e) {
Expand Down

0 comments on commit 3752a7e

Please sign in to comment.