summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-11-14 16:27:49 +0200
committerLars Wirzenius <liw@liw.fi>2020-11-14 16:30:03 +0200
commit04696e960745320dbec7b5b31713b5a280da3ad5 (patch)
treeadcdd7c74342d4fb539a1c9c66a8e4d4404204e4
parentc6b36078f7fc4f1f76b31745e1bc3e6b35450c12 (diff)
downloadjt2-04696e960745320dbec7b5b31713b5a280da3ad5.tar.gz
chore: update vendored copy of runcmd.py from Subplot
We need a bug fix from there for passing in env to runcmd_run.
-rw-r--r--subplot/runcmd.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/subplot/runcmd.py b/subplot/runcmd.py
index 532b60b..a2564c6 100644
--- a/subplot/runcmd.py
+++ b/subplot/runcmd.py
@@ -49,7 +49,16 @@ def runcmd_get_argv(ctx):
# ctx context.
def runcmd_run(ctx, argv, **kwargs):
ns = ctx.declare("_runcmd")
+
+ # The Subplot Python template empties os.environ at startup, modulo a small
+ # number of variables with carefully chosen values. Here, we don't need to
+ # care about what those variables are, but we do need to not overwrite
+ # them, so we just add anything in the env keyword argument, if any, to
+ # os.environ.
env = dict(os.environ)
+ for key, arg in kwargs.pop("env", {}).items():
+ env[key] = arg
+
pp = ns.get("path-prefix")
if pp:
env["PATH"] = pp + ":" + env["PATH"]