From 4364c1662582dd67e7246ff5be5dcc542b4cdad6 Mon Sep 17 00:00:00 2001 From: magical Date: Sat, 6 Aug 2022 08:53:09 +0000 Subject: [PATCH] set env in subprocess a little more cleanly --- clients/urwid/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clients/urwid/main.py b/clients/urwid/main.py index 79e831a..535e1b8 100644 --- a/clients/urwid/main.py +++ b/clients/urwid/main.py @@ -1601,7 +1601,9 @@ class App(object): descriptor, path = tempfile.mkstemp() with open(path, "w") as _: _.write(init_body) - call("export LANG=en_US.UTF-8; %s %s" % (self.prefs["editor"], path), shell=True) + env = os.environ.copy() + env['LANG'] = 'en_US.UTF-8' + call("%s %s" % (self.prefs["editor"], path), env=env, shell=True) with open(path) as _: body = _.read() os.remove(path)