Skip to content

Commit 58d2189

Browse files
committed
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 <module> > 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
1 parent 8dcb37f commit 58d2189

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/capture.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424

2525
p_pid, master_fd = pty.fork()
2626
if p_pid == 0: # Child.
27-
os.execvpe(argv[0], argv,
28-
env=dict(TERM="linux", COLUMNS="80", LINES="24"))
27+
env = os.environ.copy()
28+
env.update(dict(TERM="linux", COLUMNS="80", LINES="24"))
29+
os.execvpe(argv[0], argv, env=env)
2930

3031
with open(output_path, "wb") as handle:
3132
while True:

0 commit comments

Comments
 (0)