From 652cfdf094736d8a53b9176e9a2d574c8c73cc9f Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 30 Jan 2021 10:10:45 +0200 Subject: chore: update runcmd.py from Subplot --- subplot/vendored/runcmd.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/subplot/vendored/runcmd.py b/subplot/vendored/runcmd.py index 532b60b..a2564c6 100644 --- a/subplot/vendored/runcmd.py +++ b/subplot/vendored/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"] -- cgit v1.2.1