network socket support, Swing blink/reverse
[nikiroo-utils.git] / src / jexer / TTerminalWindow.java
index f85e346e4a230f646e6e41635941a516e6281f72..bb91a6317453f665a08119b8a83f0564fd9e7fa3 100644 (file)
@@ -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 {