X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTTerminalWindow.java;h=b3f83919d7ebb6e6483dac8893a4c0ac0b83545c;hb=3649b9210ea425f398ba8c24f9509669cf72aa96;hp=f85e346e4a230f646e6e41635941a516e6281f72;hpb=7c870d89433346ccb5505f8f9ba62d3fc18fe996;p=fanfix.git diff --git a/src/jexer/TTerminalWindow.java b/src/jexer/TTerminalWindow.java index f85e346..b3f8391 100644 --- a/src/jexer/TTerminalWindow.java +++ b/src/jexer/TTerminalWindow.java @@ -1,4 +1,4 @@ -/** +/* * Jexer - Java Text User Interface * * License: LGPLv3 or later @@ -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(), rc)); + 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 {