[GH-ISSUE #548] asciinema cat fails with OSError: [Errno 6] No such device or address: '/dev/tty' when running from GitHub Action #914

Closed
opened 2026-03-15 10:57:20 +03:00 by kerem · 2 comments
Owner

Originally created by @vorburger on GitHub (May 6, 2023).
Original GitHub issue: https://github.com/asciinema/asciinema/issues/548

Describe the bug

In https://github.com/enola-dev/enola/pull/142, I would like to run asciinema from a GitHub Action.

To Reproduce

Create a GitHub .github/workflows/asciinema.yaml with a run: of something which launches asciinema triggers:

asciinema: recording asciicast to /home/runner/work/enola/enola/docs/use/library/script.cast
asciinema: exit opened program when you're done
asciinema: recording finished
asciinema: asciicast saved to /home/runner/work/enola/enola/docs/use/library/script.cast

+ svg-term --window --width 80 --height 25 --in /home/runner/work/enola/enola/docs/use/library/script.cast --out /home/runner/work/enola/enola/docs/use/library/script.svg
+ asciinema cat /home/runner/work/enola/enola/docs/use/library/script.cast
+ col -b
+ perl -pe 's/\e([^\[\]]|\[.*?[a-zA-Z]|\].*?\a)//g'
Traceback (most recent call last):
  File "/home/runner/work/enola/enola/.venv/bin/asciinema", line 8, in <module>
    sys.exit(main())
  File "/home/runner/work/enola/enola/.venv/lib/python3.10/site-packages/asciinema/__main__.py", line 215, in main
    code = command.execute()
  File "/home/runner/work/enola/enola/.venv/lib/python3.10/site-packages/asciinema/commands/cat.py", line 17, in execute
    with open("/dev/tty", "rt", encoding="utf-8") as stdin:
OSError: [Errno 6] No such device or address: '/dev/tty'
Error: Process completed with exit code 123.

Versions:

  • OS: Ubuntu VM from GitHub Action
  • asciinema cli: 2.2.0

Additional context

I gathered this is related to https://github.com/actions/runner/issues/241, and understand that this isn't so much a "bug" of asciinema but a limitation of the Linux environment of a GitHub Action not having a /dev/tty.

But perhaps someone can provide some input or suggestions how to work around this? I've found https://github.com/tarides/meio/pull/48/files where @TheLortex patches a get_terminal_size() - but that doesn't seem to be where it fails above...

Originally created by @vorburger on GitHub (May 6, 2023). Original GitHub issue: https://github.com/asciinema/asciinema/issues/548 **Describe the bug** In https://github.com/enola-dev/enola/pull/142, I would like to run `asciinema` from a GitHub Action. **To Reproduce** Create a GitHub `.github/workflows/asciinema.yaml` with a `run:` of something which launches `asciinema` triggers: ``` asciinema: recording asciicast to /home/runner/work/enola/enola/docs/use/library/script.cast asciinema: exit opened program when you're done asciinema: recording finished asciinema: asciicast saved to /home/runner/work/enola/enola/docs/use/library/script.cast + svg-term --window --width 80 --height 25 --in /home/runner/work/enola/enola/docs/use/library/script.cast --out /home/runner/work/enola/enola/docs/use/library/script.svg + asciinema cat /home/runner/work/enola/enola/docs/use/library/script.cast + col -b + perl -pe 's/\e([^\[\]]|\[.*?[a-zA-Z]|\].*?\a)//g' Traceback (most recent call last): File "/home/runner/work/enola/enola/.venv/bin/asciinema", line 8, in <module> sys.exit(main()) File "/home/runner/work/enola/enola/.venv/lib/python3.10/site-packages/asciinema/__main__.py", line 215, in main code = command.execute() File "/home/runner/work/enola/enola/.venv/lib/python3.10/site-packages/asciinema/commands/cat.py", line 17, in execute with open("/dev/tty", "rt", encoding="utf-8") as stdin: OSError: [Errno 6] No such device or address: '/dev/tty' Error: Process completed with exit code 123. ``` **Versions:** - OS: Ubuntu VM from GitHub Action - asciinema cli: `2.2.0` **Additional context** I gathered this is related to https://github.com/actions/runner/issues/241, and understand that this isn't so much a "bug" of `asciinema` but a limitation of the Linux environment of a GitHub Action not having a `/dev/tty`. But perhaps someone can provide some input or suggestions how to work around this? I've found https://github.com/tarides/meio/pull/48/files where @TheLortex patches a `get_terminal_size()` - but that doesn't seem to be where it fails above...
kerem closed this issue 2026-03-15 10:57:25 +03:00
Author
Owner

@vorburger commented on GitHub (May 6, 2023):

After enabling set -x in my script, I figured that this actually seems to be specific only to asciinema cat and not asciinema rec; I will update the log above with details, and the issue title, accordingly.

I can work around this by not using asciinema cat in the GitHub Action and just change my script to to run that locally. (BTW https://github.com/zechris/asciinema-rec_script/issues/63 is something about doing that alltogether differently, otherwise unrelated to this.)

Keeping this issue open for others who may run into this and possible future better workaround.

<!-- gh-comment-id:1537212847 --> @vorburger commented on GitHub (May 6, 2023): After enabling `set -x` in my script, I figured that this actually seems to be specific only to `asciinema cat` and not `asciinema rec`; I will update the log above with details, and the issue title, accordingly. I can work around this by not using `asciinema cat` in the GitHub Action and just change my script to to run that locally. (BTW https://github.com/zechris/asciinema-rec_script/issues/63 is something about doing that alltogether differently, otherwise unrelated to this.) Keeping this issue open for others who may run into this and possible future better workaround.
Author
Owner

@ku1ik commented on GitHub (May 7, 2023):

Thanks. I think we can find a simple way to fix this for cat.

<!-- gh-comment-id:1537365077 --> @ku1ik commented on GitHub (May 7, 2023): Thanks. I think we can find a simple way to fix this for `cat`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asciinema#914
No description provided.