mirror of
https://github.com/asciinema/asciinema.git
synced 2026-04-25 16:05:52 +03:00
[GH-ISSUE #555] Getting weird character when using "--raw" option #917
Labels
No labels
bug
compatibility
feature request
fit for beginners
help wanted
hosting
idea
improvement
packaging
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/asciinema#917
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @PierreMarchand20 on GitHub (Jun 9, 2023).
Original GitHub issue: https://github.com/asciinema/asciinema/issues/555
Describe the bug
When using "--raw" option, the output file can contain weird characters. On my laptop (macOS 12.6.3) or in a docker with ubuntu latest.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I would expect to obtain an output file with
or something similar.
Versions:
Additional context
I have a small python package to script asciinema videos: https://github.com/PierreMarchand20/asciinema_automation and I want to use the output with --raw for regression tests. But when running the CI, the output does not have all these weird letters.
@ku1ik commented on GitHub (Jun 9, 2023):
Those characters are so called control characters / escape sequences, which are used for setting colors, cursor movement etc. You don't see them in your terminal when you normally run a program because they're interpreted by your terminal emulator.
Anyway, it works as intended, as it captures full raw output of your program(s).
@PierreMarchand20 commented on GitHub (Jun 9, 2023):
Any idea how to remove them ? I thought using
PS1="$ " bash --noprofile --norc'would be enough to have nothing else :-/@ku1ik commented on GitHub (Jun 10, 2023):
bash, even with most basic config, still produces esc sequences. If you want text only you need to look for a tool which strips non-text characters. I don't know one but I'm sure someone created something like this.
@PierreMarchand20 commented on GitHub (Jun 10, 2023):
thank you for your answer, your time and your amazing tool.
For posterity,
env -i PS1="$ " bash --noprofile --norc'gets pretty close to a blank shell (see https://stackoverflow.com/a/21391035).env -iremoves every environment variables in the new shell, and the extra characters seem to come from theTERMvariable.