summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-04-07 10:34:01 +0300
committerLars Wirzenius <liw@liw.fi>2023-04-07 10:35:02 +0300
commitc5ca7edc382e9bfbdf5dd36ba9ebe02d23af8e58 (patch)
tree7d45d2f015aee39b7ce05c6966f63d5c899eec90
parentc304123b0f18a7dce2138edcb92e6be2a76bf54a (diff)
downloadvmdb2-c5ca7edc382e9bfbdf5dd36ba9ebe02d23af8e58.tar.gz
fix: set locale to C.UTF8
Ansible now tests that its locale supports UTF8 (I don't know why). Also, log the environment, to help debug this kind of thing in the future. Sponsored-by: author
-rw-r--r--vmdb/runcmd.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/vmdb/runcmd.py b/vmdb/runcmd.py
index 67acde1..116c6cb 100644
--- a/vmdb/runcmd.py
+++ b/vmdb/runcmd.py
@@ -46,10 +46,12 @@ def progress(msg):
def runcmd(argv, **kwargs):
progress("Exec: %r" % (argv,))
env = kwargs.get("env", os.environ.copy())
- env["LC_ALL"] = "C"
+ env["LC_ALL"] = "C.UTF8"
kwargs["env"] = env
kwargs["stdout"] = kwargs.get("stdout", subprocess.PIPE)
kwargs["stderr"] = kwargs.get("stderr", subprocess.PIPE)
+ for name in env:
+ logging.debug(f"ENV: {name}={env[name]}")
p = subprocess.Popen(argv, **kwargs)
out, err = p.communicate()
logging.debug("STDOUT: %s", out.decode("UTF8"))