Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2015-02-20 13:50:31 +0000
committerAnton Leherbauer2015-02-20 13:50:31 +0000
commit08bb1b0e979fc811afe1b5aa0391e6479542555e (patch)
tree5e6541f7479acc45af2680db1ae7a629ef17053f /terminals/plugins/org.eclipse.tcf.te.ui.terminals.process
parent02ded1bd79dca98d61fd7f421961b326f49ed5b2 (diff)
downloadorg.eclipse.tcf-08bb1b0e979fc811afe1b5aa0391e6479542555e.tar.gz
org.eclipse.tcf-08bb1b0e979fc811afe1b5aa0391e6479542555e.tar.xz
org.eclipse.tcf-08bb1b0e979fc811afe1b5aa0391e6479542555e.zip
Terminals: Improve disconnect from local process
Better close streams first before destroying the process. An interactive program will terminate on EOF anyway. On Windows process destroy takes > 1s because cmd.exe does not respond to Spawner.terminate().
Diffstat (limited to 'terminals/plugins/org.eclipse.tcf.te.ui.terminals.process')
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessConnector.java9
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessMonitor.java5
2 files changed, 9 insertions, 5 deletions
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessConnector.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessConnector.java
index 9a8c8fba1..98400b738 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessConnector.java
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessConnector.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 - 2015 Wind River Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -240,12 +240,15 @@ public class ProcessConnector extends AbstractStreamsConnector {
*/
@Override
public void doDisconnect() {
- // Dispose the process
- if (process != null) { process.destroy(); process = null; }
+ // Stop monitoring the process
+ monitor.dispose();
// Dispose the streams
super.doDisconnect();
+ // Dispose the process
+ if (process != null) { process.destroy(); process = null; }
+
// Set the terminal control state to CLOSED.
fControl.setState(TerminalState.CLOSED);
}
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessMonitor.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessMonitor.java
index 2e3762aaf..f9cce8b65 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessMonitor.java
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessMonitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -100,7 +100,8 @@ public class ProcessMonitor {
Thread.interrupted();
} finally {
// Dispose the parent process connector
- processConnector.disconnect();
+ if (!disposed)
+ processConnector.disconnect();
}
}
}

Back to the top