Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions exiftool/exiftool.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ def terminate(self, timeout: int = 30, _del: bool = False) -> None:
#print("before comm", self._process.poll(), self._process)
self._process.poll()
# TODO freezes here on windows if subprocess zombie remains
outs, errs = self._process.communicate() # have to cleanup the process or else .poll() will return None
self._process.communicate() # have to cleanup the process or else .poll() will return None
#print("after comm")
# TODO a bug filed with Python, or user error... this doesn't seem to work at all ... .communicate() still hangs
# https://bugs.python.org/issue43784 ... Windows-specific issue affecting Python 3.8-3.10 (as of this time)
Expand All @@ -844,11 +844,10 @@ def terminate(self, timeout: int = 30, _del: bool = False) -> None:
On Linux, this runs as is, and the process terminates properly
"""
self._process.communicate(input=b"-stay_open\nFalse\n", timeout=timeout) # this is a constant sequence specified by PH's exiftool
self._process.kill()
except subprocess.TimeoutExpired: # this is new in Python 3.3 (for python 2.x, use the PyPI subprocess32 module)
self._process.kill()
outs, errs = self._process.communicate()
# err handling code from https://docs.python.org/3/library/subprocess.html#subprocess.Popen.communicate
pass
# In any case, kill the process.
self._process.kill()

self._flag_running_false()

Expand Down