Skip to content

Commit 58524a3

Browse files
authored
dont prevent sigint propagation for 'normal' ffmpeg calls (#37)
1 parent 41730e0 commit 58524a3

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

imageio_ffmpeg/_io.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def read_frames(
146146
stdin=subprocess.PIPE,
147147
stdout=subprocess.PIPE,
148148
stderr=subprocess.PIPE,
149-
**_popen_kwargs()
149+
**_popen_kwargs(prevent_sigint=True)
150150
)
151151

152152
log_catcher = LogCatcher(p.stderr)
@@ -437,7 +437,7 @@ def write_frames(
437437
stdin=subprocess.PIPE,
438438
stdout=subprocess.PIPE,
439439
stderr=None,
440-
**_popen_kwargs()
440+
**_popen_kwargs(prevent_sigint=True)
441441
)
442442

443443
# Note that directing stderr to a pipe on windows will cause ffmpeg

imageio_ffmpeg/_utils.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,21 @@ def get_ffmpeg_exe():
5252
)
5353

5454

55-
def _popen_kwargs():
55+
def _popen_kwargs(prevent_sigint=False):
5656
startupinfo = None
5757
preexec_fn = None
5858
creationflags = 0
5959
if sys.platform.startswith("win"):
6060
# Stops executable from flashing on Windows (see #22)
6161
startupinfo = subprocess.STARTUPINFO()
6262
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
63-
# Prevent propagation of sigint (see #4)
64-
creationflags = 0x00000200
65-
else:
63+
if prevent_sigint:
6664
# Prevent propagation of sigint (see #4)
6765
# https://stackoverflow.com/questions/5045771
68-
preexec_fn = os.setpgrp # the _pre_exec does not seem to work
66+
if sys.platform.startswith("win"):
67+
creationflags = 0x00000200
68+
else:
69+
preexec_fn = os.setpgrp # the _pre_exec does not seem to work
6970
return {
7071
"startupinfo": startupinfo,
7172
"creationflags": creationflags,

0 commit comments

Comments
 (0)