From 58d2189c5fff0f308ab4b41151ab795f598f2cf0 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Sat, 25 Nov 2023 01:49:31 +0100 Subject: [PATCH] examples/capture.py: Pass HOME environment variable (primarily) Symptom was: > # python3 ./examples/capture.py output.txt asciinema rec -c 'timeout 3 htop' output.cast > Traceback (most recent call last): > File "/usr/lib/python-exec/python3.10/asciinema", line 8, in > sys.exit(main()) > File "/usr/lib/python3.10/site-packages/asciinema/__main__.py", line 61, in main > cfg = config.load() > File "/usr/lib/python3.10/site-packages/asciinema/config.py", line 226, in load > config = Config(get_config_home(env), env) > File "/usr/lib/python3.10/site-packages/asciinema/config.py", line 216, in get_config_home > raise Exception( > Exception: need $HOME or $XDG_CONFIG_HOME or $ASCIINEMA_CONFIG_HOME --- examples/capture.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/capture.py b/examples/capture.py index 8e60931..174a7b3 100644 --- a/examples/capture.py +++ b/examples/capture.py @@ -24,8 +24,9 @@ p_pid, master_fd = pty.fork() if p_pid == 0: # Child. - os.execvpe(argv[0], argv, - env=dict(TERM="linux", COLUMNS="80", LINES="24")) + env = os.environ.copy() + env.update(dict(TERM="linux", COLUMNS="80", LINES="24")) + os.execvpe(argv[0], argv, env=env) with open(output_path, "wb") as handle: while True: