Skip to content

Commit

Permalink
fix(process): Debug Launch to return true for disconnect and terminate
Browse files Browse the repository at this point in the history
  • Loading branch information
alirana01 committed Nov 20, 2024
1 parent ea0c653 commit 9fde565
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,23 +264,23 @@ public Process call() throws CoreException
public void terminate() throws DebugException
{
super.terminate();
for(IProcess process : getProcesses())
{
if (process != null)
{
try
{
process.terminate();
}
catch (Exception e)
{
e.printStackTrace();
}

}
}

LaunchProcessDictionary.getInstance().killAllProcessesInLaunch(getLaunchConfiguration().getName());
}

@Override
public boolean canDisconnect()
{
return true;
}

@Override
public boolean canTerminate()
{
return true;
}


@Override
public IProcess[] getProcesses()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.HashMap;
import java.util.Map;

import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IProcess;

public class LaunchProcessDictionary
Expand Down Expand Up @@ -48,5 +49,25 @@ public IProcess getProcessFromDictionary(String launchName, String procName)

return processDictionary.get(launchName).get(procName);
}

public void killAllProcessesInLaunch(String launchName)
{
if(!processDictionary.containsKey(launchName))
{
return;
}

for (IProcess process : processDictionary.get(launchName).values())
{
try
{
process.terminate();
}
catch (DebugException e)
{
e.printStackTrace();
}
}
}

}

0 comments on commit 9fde565

Please sign in to comment.