set env in subprocess a little more cleanly

master
magical 2022-08-06 08:53:09 +00:00
parent deb8d3ba4b
commit 4364c16625
1 changed files with 3 additions and 1 deletions

View File

@ -1601,7 +1601,9 @@ class App(object):
descriptor, path = tempfile.mkstemp() descriptor, path = tempfile.mkstemp()
with open(path, "w") as _: with open(path, "w") as _:
_.write(init_body) _.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 _: with open(path) as _:
body = _.read() body = _.read()
os.remove(path) os.remove(path)