eric6/DebugClients/Python/QProcessExtension.py

branch
multi_processing
changeset 7424
9bb7d8b0f966
parent 7419
9c1163735448
child 7901
6ff7ccf0cb50
equal deleted inserted replaced
7422:9a008ab4811b 7424:9bb7d8b0f966
8 process. 8 process.
9 """ 9 """
10 10
11 import os 11 import os
12 12
13 from DebugUtilities import isPythonProgram, patchArguments 13 from DebugUtilities import isPythonProgram, startsWithShebang, patchArguments
14 14
15 _debugClient = None 15 _debugClient = None
16 16
17 17
18 def patchQProcess(module, debugClient): 18 def patchQProcess(module, debugClient):
77 if len(args) == 1: 77 if len(args) == 1:
78 mode = args[0] 78 mode = args[0]
79 else: 79 else:
80 mode = module.QIODevice.ReadWrite 80 mode = module.QIODevice.ReadWrite
81 ok = isPythonProgram(program) 81 ok = isPythonProgram(program)
82 if ( 82 if ok:
83 ok and ( 83 if startsWithShebang(program):
84 not os.path.basename(arguments[0]) 84 scriptName = os.path.basename(program)
85 in _debugClient.noDebugList 85 else:
86 ) 86 scriptName = os.path.basename(arguments[0])
87 ): 87 if scriptName not in _debugClient.noDebugList:
88 newArgs = patchArguments( 88 newArgs = patchArguments(
89 _debugClient, 89 _debugClient,
90 [program] + arguments, 90 [program] + arguments,
91 ) 91 )
92 super(QProcessWrapper, self).start( 92 super(QProcessWrapper, self).start(
93 newArgs[0], newArgs[1:], mode) 93 newArgs[0], newArgs[1:], mode)
94 return 94 return
95 95
96 super(QProcessWrapper, self).start(*args, **kwargs) 96 super(QProcessWrapper, self).start(*args, **kwargs)
97 97
98 ################################################################### 98 ###################################################################
99 ## Handling of 'startDetached(...)' below 99 ## Handling of 'startDetached(...)' below
178 wd = args[2] 178 wd = args[2]
179 else: 179 else:
180 wd = "" 180 wd = ""
181 ok = isPythonProgram(program) 181 ok = isPythonProgram(program)
182 if ok: 182 if ok:
183 newArgs = patchArguments( 183 if startsWithShebang(program):
184 _debugClient, 184 scriptName = os.path.basename(program)
185 [program] + arguments, 185 else:
186 ) 186 scriptName = os.path.basename(arguments[0])
187 return QProcessWrapper._origQProcessStartDetached( 187 if scriptName not in _debugClient.noDebugList:
188 newArgs[0], newArgs[1:], wd) 188 newArgs = patchArguments(
189 _debugClient,
190 [program] + arguments,
191 )
192 return QProcessWrapper._origQProcessStartDetached(
193 newArgs[0], newArgs[1:], wd)
189 194
190 return QProcessWrapper._origQProcessStartDetached( 195 return QProcessWrapper._origQProcessStartDetached(
191 *args, **kwargs) 196 *args, **kwargs)
192 197
193 _debugClient = debugClient 198 _debugClient = debugClient

eric ide

mercurial