74 |
74 |
75 if sys.version_info >= (3, 4): |
75 if sys.version_info >= (3, 4): |
76 _originalProcess._bootstrap = ProcessWrapper._bootstrap |
76 _originalProcess._bootstrap = ProcessWrapper._bootstrap |
77 else: |
77 else: |
78 module.Process = ProcessWrapper |
78 module.Process = ProcessWrapper |
79 |
|
80 ## if sys.version_info >= (3, 4): |
|
81 ## _originalProcess = module.Process |
|
82 #### _originalProcess = module.process.BaseProcess |
|
83 ## else: |
|
84 ## _originalProcess = module.Process |
|
85 ## class ProcessWrapper(_originalProcess): |
|
86 ## def __init__(self, *args, **kwargs): |
|
87 ## super(ProcessWrapper, self).__init__(*args, **kwargs) |
|
88 ## self._run = self.run |
|
89 ## self.run = self._bootstrap_eric6 |
|
90 ## # Class attributes are not transfered to new process. Therefore make a |
|
91 ## # copy as instance attribute |
|
92 ## self._options = _debugClient.startOptions |
|
93 ## |
|
94 ## def _bootstrap_eric6(self): |
|
95 ## """ |
|
96 ## Bootstrap for threading, which reports exceptions correctly. |
|
97 ## |
|
98 ## @param run the run method of threading.Thread |
|
99 ## @type method pointer |
|
100 ## """ |
|
101 ## from DebugClient import DebugClient |
|
102 ## self.debugClient = DebugClient() |
|
103 ## |
|
104 ## (_wd, host, port, exceptions, tracePython, redirect, |
|
105 ## noencoding) = self._options[:7] |
|
106 ## |
|
107 ## args = sys.argv |
|
108 ## self.debugClient.name = self.name |
|
109 ## |
|
110 ## self.debugClient.startDebugger(args[0], host, port, |
|
111 ## exceptions=exceptions, |
|
112 ## tracePython=tracePython, |
|
113 ## redirect=redirect) |
|
114 ## |
|
115 ## try: |
|
116 ## self._run() |
|
117 ## except Exception: |
|
118 ## excinfo = sys.exc_info() |
|
119 ## self.debugClient.user_exception(excinfo, True) |
|
120 ## finally: |
|
121 ## sys.settrace(None) |
|
122 ## |
|
123 ## if sys.version_info >= (3, 4): |
|
124 ## module.Process = ProcessWrapper |
|
125 #### module.process.BaseProcess = ProcessWrapper |
|
126 ## else: |
|
127 ## module.Process = ProcessWrapper |
|