Skip to content

Commit 948e355

Browse files
committed
Use subprocess umask support
This requires Python 3.9 or newer
1 parent 9953897 commit 948e355

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/buildstream/utils.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,14 +1260,7 @@ def _call(*popenargs, terminate=False, **kwargs):
12601260

12611261
process = None
12621262

1263-
old_preexec_fn = kwargs.get("preexec_fn")
1264-
if "preexec_fn" in kwargs:
1265-
del kwargs["preexec_fn"]
1266-
1267-
def preexec_fn():
1268-
os.umask(stat.S_IWGRP | stat.S_IWOTH)
1269-
if old_preexec_fn is not None:
1270-
old_preexec_fn()
1263+
kwargs["umask"] = stat.S_IWGRP | stat.S_IWOTH
12711264

12721265
# Handle termination, suspend and resume
12731266
def kill_proc():
@@ -1313,7 +1306,7 @@ def resume_proc():
13131306
os.killpg(group_id, signal.SIGCONT)
13141307

13151308
with _signals.suspendable(suspend_proc, resume_proc), _signals.terminator(kill_proc), subprocess.Popen(
1316-
*popenargs, preexec_fn=preexec_fn, universal_newlines=True, **kwargs
1309+
*popenargs, universal_newlines=True, **kwargs
13171310
) as process:
13181311
# Here, we don't use `process.communicate()` directly without a timeout
13191312
# This is because, if we were to do that, and the process would never

0 commit comments

Comments
 (0)