X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTTerminalWindow.java;h=bb91a6317453f665a08119b8a83f0564fd9e7fa3;hb=55b4f29bc5389d9ce185efa9f6e14c5f3882ac70;hp=f85e346e4a230f646e6e41635941a516e6281f72;hpb=ef368bd06a88a1701fab31f9459d8641f53c2867;p=nikiroo-utils.git diff --git a/src/jexer/TTerminalWindow.java b/src/jexer/TTerminalWindow.java index f85e346..bb91a63 100644 --- a/src/jexer/TTerminalWindow.java +++ b/src/jexer/TTerminalWindow.java @@ -281,11 +281,18 @@ public class TTerminalWindow extends TWindow { // Check to see if the shell has died. if (!emulator.isReading() && (shell != null)) { - // The emulator exited on its own, all is fine - setTitle(String.format("%s [Completed - %d]", - getTitle(), shell.exitValue())); - shell = null; - emulator.close(); + try { + int rc = shell.exitValue(); + // The emulator exited on its own, all is fine + setTitle(String.format("%s [Completed - %d]", + getTitle(), shell.exitValue())); + shell = null; + emulator.close(); + } catch (IllegalThreadStateException e) { + // The emulator thread has exited, but the shell Process + // hasn't figured that out yet. Do nothing, we will see + // this in a future tick. + } } else if (emulator.isReading() && (shell != null)) { // The shell might be dead, let's check try {