private void stopProcess() { if (m_launch != null && !m_launch.isTerminated()) { try { if (Platform.OS_WIN32.equals(Platform.getOS())) { m_launch.terminate(); } else { for (IProcess p : m_launch.getProcesses()) { try { Method m = p.getClass().getDeclaredMethod("getSystemProcess"); m.setAccessible(true); Process proc = (Process) m.invoke(p); Field f = proc.getClass().getDeclaredField("pid"); f.setAccessible(true); int pid = (int) f.get(proc); // force kill the process on OSX and Linux-like platform // since on Linux the default behaviour of Process.destroy() is to gracefully shutdown // which rarely can stop the busy process Runtime rt = Runtime.getRuntime(); rt.exec("kill -9 " + pid); } catch (Exception ex) { TestNGPlugin.log(ex); } } } } catch (DebugException e) { TestNGPlugin.log(e); } } }
@Override public void done(IJobChangeEvent event) { try { if (event.getResult().isOK()) { DotnetDebugLaunchDelegate.super.launch(config, mode, launch, monitor); } else { launch.terminate(); } } catch (Exception ex) { AcutePlugin.logError(ex); } super.done(event); } });
l.terminate(); break;
/** * finds and terminates any running launch configurations associated with the given resource * @param resource the resource to search for launch configurations and hence launches for * @since 3.2 */ protected void terminateMappedConfigurations(IResource resource) { ILaunch[] launches = getLaunches(); ILaunchConfiguration[] configs = getMappedConfigurations(resource); try { for(int i = 0; i < launches.length; i++) { for(int j = 0; j < configs.length; j++) { if(configs[j].equals(launches[i].getLaunchConfiguration()) & launches[i].canTerminate()) { launches[i].terminate(); } } } } catch(CoreException e) {DebugPlugin.log(e);} }
if (!launch.isTerminated()) { try { launch.terminate(); } catch (Exception ex) {
public void run() { try { if (id == TERMINATE_ID) { operation[0]= DebugUIMessages.HotCodeReplaceErrorDialog_5; target.terminate(); } else if (id == DISCONNECT_ID){ operation[0]= DebugUIMessages.HotCodeReplaceErrorDialog_6; target.disconnect(); } else { operation[0]= DebugUIMessages.HotCodeReplaceErrorDialog_8; ILaunch launch = target.getLaunch(); launch.terminate(); ILaunchConfiguration config = launch.getLaunchConfiguration(); if (config != null && config.exists()) { DebugUITools.launch(config, launch.getLaunchMode()); } } } catch (DebugException e) { ex[0] = e; } } };