Skip to content

Commit

Permalink
examples/capture.py: Pass HOME environment variable (primarily)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hartwork authored and superbobry committed Dec 21, 2023
1 parent 15edac5 commit eac6000
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions examples/capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit eac6000

Please sign in to comment.