From 9792926712ad3ca415ebd29c757fcd7407131c2d Mon Sep 17 00:00:00 2001 From: Martin Oberhuber < martin.oberhuber@windriver.com> Date: Fri, 3 Aug 2007 14:40:40 +0000 Subject: [PATCH] [161838] local shell reports isActive() wrong --- .../internal/services/local/shells/LocalHostShell.java | 10 ++++++++-- .../services/local/shells/LocalShellThread.java | 8 ++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/internal/services/local/shells/LocalHostShell.java b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/internal/services/local/shells/LocalHostShell.java index 9cdd46b3958..250a9046370 100644 --- a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/internal/services/local/shells/LocalHostShell.java +++ b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/internal/services/local/shells/LocalHostShell.java @@ -12,7 +12,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [161838] local shell reports isActive() wrong *******************************************************************************/ package org.eclipse.rse.internal.services.local.shells; @@ -52,7 +52,13 @@ public class LocalHostShell extends AbstractHostShell implements IHostShell */ public boolean isActive() { - return _shellThread.isAlive(); + if (_stdoutHandler.isFinished()) { + if (_shellThread.isAlive()) { + _shellThread.stopThread(); + } + return false; + } + return true; } /* (non-Javadoc) diff --git a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/internal/services/local/shells/LocalShellThread.java b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/internal/services/local/shells/LocalShellThread.java index a8aaec3ea4e..2223846da82 100644 --- a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/internal/services/local/shells/LocalShellThread.java +++ b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/internal/services/local/shells/LocalShellThread.java @@ -15,6 +15,7 @@ * Javier Montalvo OrĂºs (Symbian) - 138619: Fix codepage on Win2K * Lothar Werzinger (Tradescape) - 161838: Support terminating local shells * David McKnight (IBM) - [189387] Use specified encoding for shell output + * Martin Oberhuber (Wind River) - [161838] local shell reports isActive() wrong *******************************************************************************/ package org.eclipse.rse.internal.services.local.shells; @@ -359,7 +360,9 @@ public class LocalShellThread extends Thread } catch (IOException e) { - System.out.println(e); + //MOB: Exception is expected when the process is already dead + //System.out.println(e); + // make the thread exit; _isShell = false; } @@ -381,7 +384,8 @@ public class LocalShellThread extends Thread } catch (InterruptedException e) { - System.out.println(e); + //System.out.println(e); + _isCancelled = true; } //This function is where the Threads do real work, and return false when finished