X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTTerminalWindow.java;h=6d89e529580f0993b812bade180de4db2b33bea2;hb=0d47c5460c8e9d1198928308767a63ad35f46eb8;hp=f85e346e4a230f646e6e41635941a516e6281f72;hpb=7c870d89433346ccb5505f8f9ba62d3fc18fe996;p=fanfix.git diff --git a/src/jexer/TTerminalWindow.java b/src/jexer/TTerminalWindow.java index f85e346..6d89e52 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(), 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 {