Skip to content

Commit 37aae2f

Browse files
committed
fix(minidump_parser): improve subprocess handling
1 parent 3f34db4 commit 37aae2f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/ffpuppet/minidump_parser.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from __future__ import annotations
77

8+
import sys
89
from json import JSONDecodeError, load
910
from logging import DEBUG, INFO, basicConfig, getLogger
1011
from pathlib import Path
@@ -13,6 +14,12 @@
1314
from tempfile import TemporaryFile, mkdtemp
1415
from typing import IO, Any
1516

17+
if sys.platform == "win32":
18+
# pylint: disable=ungrouped-imports
19+
from subprocess import CREATE_NEW_PROCESS_GROUP
20+
else:
21+
CREATE_NEW_PROCESS_GROUP = 0
22+
1623
EXTRA_FIELDS = (
1724
# android only
1825
"CrashType",
@@ -233,7 +240,15 @@ def create_log(self, src: Path, filename: str, timeout: int = 300) -> Path:
233240
):
234241
LOG.debug("running '%s'", " ".join(cmd))
235242
try:
236-
run(cmd, check=True, stderr=err_fp, stdout=out_fp, timeout=timeout)
243+
run(
244+
cmd,
245+
check=True,
246+
creationflags=CREATE_NEW_PROCESS_GROUP,
247+
start_new_session=sys.platform != "win32",
248+
stderr=err_fp,
249+
stdout=out_fp,
250+
timeout=timeout,
251+
)
237252
out_fp.seek(0)
238253
# load json, format data and write log
239254
with dst.open("wb") as log_fp:

0 commit comments

Comments
 (0)