Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9.2, 1.9.3, and 2.0

cmdui: implement is_running and cancel for external processes

Changeset 61b452e3fae2

Parent 6b944bf5c5bc

by Steve Borho

Changes to one file · Browse files at 61b452e3fae2 Showing diff from parent 6b944bf5c5bc Diff from another changeset...

 
145
146
147
 
148
149
150
 
173
174
175
176
 
 
 
 
 
 
 
177
178
179
180
181
182
183
 
 
 
 
 
 
 
184
185
186
 
220
221
222
 
223
224
225
 
145
146
147
148
149
150
151
 
174
175
176
 
177
178
179
180
181
182
183
184
185
186
187
188
189
 
190
191
192
193
194
195
196
197
198
199
 
233
234
235
236
237
238
239
@@ -145,6 +145,7 @@
  super(Core, self).__init__(parent)     self.thread = None + self.extproc = None   self.stbar = None   self.queue = []   self.rawoutput = [] @@ -173,14 +174,26 @@
  def cancel(self):   '''Cancel running Mercurial command'''   if self.is_running(): - self.thread.abort() + if self.extproc: + try: + self.extproc.close() + except AttributeError: + pass + elif self.thread: + self.thread.abort()   self.commandCanceling.emit()     def set_stbar(self, stbar):   self.stbar = stbar     def is_running(self): - return bool(self.thread and self.thread.isRunning()) + if self.extproc: + try: + return self.extproc.state() != QProcess.NotRunning + except AttributeError: + return False + elif self.thread: + return self.thread.isRunning()     def get_rawoutput(self):   return ''.join(self.rawoutput) @@ -220,6 +233,7 @@
  start(self.queue.pop(0), '')   else:   self.queue = [] + self.extproc = None   self.commandFinished.emit(ret)     def handleerror(error):