Skip to content

Commit 205364f

Browse files
committed
exiftool.terminate(); kill process unconditionally
Also don't get outs nor errs from Popen.communicate() Fixes #63
1 parent 0294842 commit 205364f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

exiftool/exiftool.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ def terminate(self, timeout: int = 30, _del: bool = False) -> None:
831831
#print("before comm", self._process.poll(), self._process)
832832
self._process.poll()
833833
# TODO freezes here on windows if subprocess zombie remains
834-
outs, errs = self._process.communicate() # have to cleanup the process or else .poll() will return None
834+
self._process.communicate() # have to cleanup the process or else .poll() will return None
835835
#print("after comm")
836836
# TODO a bug filed with Python, or user error... this doesn't seem to work at all ... .communicate() still hangs
837837
# https://bugs.python.org/issue43784 ... Windows-specific issue affecting Python 3.8-3.10 (as of this time)
@@ -844,11 +844,10 @@ def terminate(self, timeout: int = 30, _del: bool = False) -> None:
844844
On Linux, this runs as is, and the process terminates properly
845845
"""
846846
self._process.communicate(input=b"-stay_open\nFalse\n", timeout=timeout) # this is a constant sequence specified by PH's exiftool
847-
self._process.kill()
848847
except subprocess.TimeoutExpired: # this is new in Python 3.3 (for python 2.x, use the PyPI subprocess32 module)
849-
self._process.kill()
850-
outs, errs = self._process.communicate()
851-
# err handling code from https://docs.python.org/3/library/subprocess.html#subprocess.Popen.communicate
848+
pass
849+
# In any case, kill the process.
850+
self._process.kill()
852851

853852
self._flag_running_false()
854853

0 commit comments

Comments
 (0)