Skip to content

Commit 02290ce

Browse files
author
Douglas Lassance
committed
Add "shell" keyword argument to start method
On Windows this will allow to run exiftool without showing the DOS shell.
1 parent 3db3764 commit 02290ce

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

exiftool.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def __init__(self, executable_=None):
155155
self.executable = executable_
156156
self.running = False
157157

158-
def start(self):
158+
def start(self, shell=True):
159159
"""Start an ``exiftool`` process in batch mode for this instance.
160160
161161
This method will issue a ``UserWarning`` if the subprocess is
@@ -167,11 +167,16 @@ def start(self):
167167
warnings.warn("ExifTool already running; doing nothing.")
168168
return
169169
with open(os.devnull, "w") as devnull:
170+
startupInfo = subprocess.STARTUPINFO()
171+
if not shell:
172+
# Adding enum 11 (SW_FORCEMINIMIZE in win32api speak) will
173+
# keep it from throwing up a DOS shell when it launches.
174+
startupInfo.dwFlags |= 11
170175
self._process = subprocess.Popen(
171176
[self.executable, "-stay_open", "True", "-@", "-",
172177
"-common_args", "-G", "-n"],
173178
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
174-
stderr=devnull)
179+
stderr=devnull, startupinfo=startupInfo)
175180
self.running = True
176181

177182
def terminate(self):

0 commit comments

Comments
 (0)