Skip to content

Commit

Permalink
critical bug fix for non-windows systems
Browse files Browse the repository at this point in the history
  • Loading branch information
Laharah committed Aug 8, 2016
1 parent c9750fc commit 65a39c3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions filebottool/killableprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def _execute_child_27(self, args, executable, preexec_fn, close_fds,
args = comspec + " /c " + args

# We create a new job for this process, so that we can kill
# the process and any sub-processes
# the process and any sub-processes
self._job = winprocess.CreateJobObject()

creationflags |= winprocess.CREATE_SUSPENDED
Expand Down Expand Up @@ -172,10 +172,10 @@ def _close_in_parent(fd):
winprocess.ResumeThread(ht)


def _execute_child(self, *args):
if sys.version_info[:2] == (2, 6):
args = args[:10] + ([],) + args[10:]
return self._execute_child_27(*args)
def _execute_child(self, *args):
if sys.version_info[:2] == (2, 6):
args = args[:10] + ([],) + args[10:]
return self._execute_child_27(*args)

def kill(self, group=True):
"""Kill the process. If group=True, all sub-processes will also be killed."""
Expand All @@ -184,7 +184,7 @@ def kill(self, group=True):
winprocess.TerminateJobObject(self._job, 127)
else:
winprocess.TerminateProcess(self._handle, 127)
self.returncode = 127
self.returncode = 127
else:
if group:
os.killpg(self.pid, signal.SIGKILL)
Expand Down Expand Up @@ -213,7 +213,7 @@ def wait(self, timeout=-1, group=True):
if timeout == -1:
subprocess.Popen.wait(self)
return self.returncode

starttime = time.time()

# Make sure there is a signal handler for SIGCHLD installed
Expand All @@ -225,7 +225,7 @@ def wait(self, timeout=-1, group=True):
self._handle_exitstatus(sts)
signal.signal(signal.SIGCHLD, oldsignal)
return self.returncode

# time.sleep is interrupted by signals (good!)
newtimeout = timeout - time.time() + starttime
time.sleep(newtimeout)
Expand Down

0 comments on commit 65a39c3

Please sign in to comment.