mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 09:03:31 +07:00
Merge remote branch 'origin/master'
This commit is contained in:
@@ -48,8 +48,9 @@ def patch_args(args):
|
||||
def monkey_patch_os(funcname, create_func):
|
||||
if hasattr(os, funcname):
|
||||
original_name = 'original_' + funcname
|
||||
setattr(os, original_name, getattr(os, funcname))
|
||||
setattr(os, funcname, create_func(original_name))
|
||||
if not hasattr(os, original_name):
|
||||
setattr(os, original_name, getattr(os, funcname))
|
||||
setattr(os, funcname, create_func(original_name))
|
||||
|
||||
def create_execl(original_name):
|
||||
def new_execl(path, *args):
|
||||
|
||||
@@ -183,9 +183,6 @@ def process_exec_queue(interpreter):
|
||||
continue
|
||||
|
||||
|
||||
def ExitPass():
|
||||
pass
|
||||
|
||||
try:
|
||||
try:
|
||||
exitfunc = sys.exitfunc
|
||||
@@ -195,8 +192,12 @@ try:
|
||||
IPYTHON = True
|
||||
if exitfunc is not None:
|
||||
sys.exitfunc = exitfunc
|
||||
|
||||
else:
|
||||
sys.exitfunc = ExitPass
|
||||
try:
|
||||
delattr(sys, 'exitfunc')
|
||||
except :
|
||||
pass
|
||||
except:
|
||||
IPYTHON = False
|
||||
#sys.stderr.write('PyDev console: started.\n')
|
||||
|
||||
@@ -612,6 +612,7 @@ class PyDB:
|
||||
pass
|
||||
|
||||
else:
|
||||
found = False
|
||||
try:
|
||||
if type == 'django-line':
|
||||
del self.django_breakpoints[file][line]
|
||||
@@ -620,14 +621,22 @@ class PyDB:
|
||||
else:
|
||||
try:
|
||||
del self.django_breakpoints[file][line]
|
||||
found = True
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
del self.breakpoints[file][line] #remove the breakpoint in that line
|
||||
found = True
|
||||
except:
|
||||
pass
|
||||
|
||||
if DebugInfoHolder.DEBUG_TRACE_BREAKPOINTS > 0:
|
||||
sys.stderr.write('Removed breakpoint:%s\n' % (file,))
|
||||
sys.stderr.write('Removed breakpoint:%s - %s\n' % (file, line))
|
||||
sys.stderr.flush()
|
||||
except KeyError:
|
||||
found = False
|
||||
|
||||
if not found:
|
||||
#ok, it's not there...
|
||||
if DebugInfoHolder.DEBUG_TRACE_BREAKPOINTS > 0:
|
||||
#Sometimes, when adding a breakpoint, it adds a remove command before (don't really know why)
|
||||
@@ -1279,7 +1288,7 @@ if __name__ == '__main__':
|
||||
pydevd_vm_type.SetupType(setup.get('vm_type', None))
|
||||
|
||||
DebugInfoHolder.DEBUG_RECORD_SOCKET_READS = setup.get('DEBUG_RECORD_SOCKET_READS', False)
|
||||
DebugInfoHolder.DEBUG_TRACE_BREAKPOINTS = setup.get('', -1)
|
||||
DebugInfoHolder.DEBUG_TRACE_BREAKPOINTS = setup.get('DEBUG_TRACE_BREAKPOINTS', -1)
|
||||
DebugInfoHolder.DEBUG_TRACE_LEVEL = setup.get('DEBUG_TRACE_LEVEL', -1)
|
||||
|
||||
port = setup['port']
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.jetbrains.django.util.DjangoUtil;
|
||||
import com.jetbrains.python.console.pydev.PydevCompletionVariant;
|
||||
import com.jetbrains.python.debugger.django.DjangoExceptionBreakpointHandler;
|
||||
import com.jetbrains.python.debugger.pydev.*;
|
||||
import com.jetbrains.python.run.PythonProcessHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -527,12 +528,19 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr
|
||||
|
||||
@Override
|
||||
public void processTerminated(ProcessEvent event) {
|
||||
myDebugger.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWillTerminate(ProcessEvent event, boolean willBeDestroyed) {
|
||||
myClosing = true;
|
||||
myDebugger.close();
|
||||
setKillingStrategy();
|
||||
}
|
||||
|
||||
private void setKillingStrategy() {
|
||||
if (getSession().isSuspended() && myProcessHandler instanceof PythonProcessHandler) {
|
||||
((PythonProcessHandler)myProcessHandler).setShouldTryToKillSoftly(false); //while process is suspended it can't terminate softly, so its better to kill all the tree hard
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,10 +25,7 @@ import com.jetbrains.python.console.PythonConsoleView;
|
||||
import com.jetbrains.python.console.PythonDebugConsoleCommunication;
|
||||
import com.jetbrains.python.console.PythonDebugLanguageConsoleView;
|
||||
import com.jetbrains.python.console.pydev.ConsoleCommunication;
|
||||
import com.jetbrains.python.run.AbstractPythonRunConfiguration;
|
||||
import com.jetbrains.python.run.CommandLinePatcher;
|
||||
import com.jetbrains.python.run.PythonCommandLineState;
|
||||
import com.jetbrains.python.run.PythonRunConfiguration;
|
||||
import com.jetbrains.python.run.*;
|
||||
import com.jetbrains.python.sdk.PythonSdkFlavor;
|
||||
import com.jetbrains.rest.run.RestRunConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -12,6 +12,8 @@ import java.nio.charset.Charset;
|
||||
* @author traff
|
||||
*/
|
||||
public class PythonProcessHandler extends KillableColoredProcessHandler {
|
||||
private boolean myShouldTryToKillSoftly = true;
|
||||
|
||||
protected PythonProcessHandler(@NotNull Process process, @NotNull GeneralCommandLine commandLine) {
|
||||
super(process, commandLine.getCommandLineString());
|
||||
}
|
||||
@@ -20,6 +22,15 @@ public class PythonProcessHandler extends KillableColoredProcessHandler {
|
||||
super(process, commandLine, charset);
|
||||
}
|
||||
|
||||
public void setShouldTryToKillSoftly(boolean shouldTryToKillSoftly) {
|
||||
myShouldTryToKillSoftly = shouldTryToKillSoftly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canKillSoftly() {
|
||||
return super.canKillSoftly() && myShouldTryToKillSoftly;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldDestroyProcessRecursively() {
|
||||
return true;
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.execution.process.RunnerMediator;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.jetbrains.python.sdk.JythonSdkFlavor;
|
||||
import com.jetbrains.python.sdk.PythonSdkFlavor;
|
||||
|
||||
@@ -19,7 +20,7 @@ public class PythonProcessRunner {
|
||||
return JythonProcessHandler.createProcessHandler(commandLine);
|
||||
}
|
||||
else {
|
||||
if (withMediator) {
|
||||
if (withMediator && SystemInfo.isWindows) {
|
||||
return RunnerMediator.getInstance().createProcess(commandLine);
|
||||
}
|
||||
else {
|
||||
@@ -35,5 +36,4 @@ public class PythonProcessRunner {
|
||||
public static ProcessHandler createProcessHandlingCtrlC(GeneralCommandLine commandLine) throws ExecutionException {
|
||||
return createProcess(commandLine, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user