Skip to content

Commit

Permalink
Bug fix: Stop timer used by wait_for_process() after waiting
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed Jan 10, 2017
1 parent b64ce41 commit bcf5e4c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions executor/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ def wait_for_process(self, timeout=0, use_spinner=None):
:returns: A :class:`~humanfriendly.Timer` object telling you how long
it took to wait for the process.
"""
timer = Timer()
with Spinner(interactive=use_spinner, timer=timer) as spinner:
while self.is_running:
if timeout and timer.elapsed_time >= timeout:
break
spinner.step(label="Waiting for process %i to terminate" % self.pid)
spinner.sleep()
return timer
with Timer(resumable=True) as timer:
with Spinner(interactive=use_spinner, timer=timer) as spinner:
while self.is_running:
if timeout and timer.elapsed_time >= timeout:
break
spinner.step(label="Waiting for process %i to terminate" % self.pid)
spinner.sleep()
return timer

def terminate(self, wait=True, timeout=DEFAULT_TIMEOUT, use_spinner=None):
"""
Expand Down

0 comments on commit bcf5e4c

Please sign in to comment.