[GH-ISSUE #165] poor fish shell support/documentation #740

Closed
opened 2026-03-15 10:08:41 +03:00 by kerem · 3 comments
Owner

Originally created by @piotrgo on GitHub (Jul 6, 2016).
Original GitHub issue: https://github.com/asciinema/asciinema/issues/165

I'm using fish shell and have encountered a problem where "prompt/theme isn't working during recording". There's a section in FAQ that suggest setting up custom command to run in the config:

[record]
command="/usr/local/bin/fish -l"

I've tried doing so, but with no luck.
Then I decided to poke around the source, and in terminal/terminal.go I've found this:

func (p *Pty) Record(command string, w io.Writer) error {
    // start command in pty
    cmd := exec.Command("sh", "-c", command)
    cmd.Env = append(os.Environ(), "ASCIINEMA_REC=1")
    master, err := pty.Start(cmd)

As you can see the command to run is actually always a subcommand executed in sh. I assume this is ok, as long as you use bash or any other POSIX compliant shell, but that's not the case with fish.

I've changed that bit to cmd := exec.Command("/usr/local/bin/fish", "-c", command), compiled it, passed the tests and it works like a charm!

Now, I am new to Go but I'd be happy to take a shot on adding another config value to enable fish support, but before I even start it would be good to know if that would be even considered as a feature :-)

Originally created by @piotrgo on GitHub (Jul 6, 2016). Original GitHub issue: https://github.com/asciinema/asciinema/issues/165 I'm using fish shell and have encountered a problem where "prompt/theme isn't working during recording". There's a section in FAQ that suggest setting up custom command to run in the config: ``` [record] command="/usr/local/bin/fish -l" ``` I've tried doing so, but with no luck. Then I decided to poke around the source, and in terminal/terminal.go I've found this: ``` func (p *Pty) Record(command string, w io.Writer) error { // start command in pty cmd := exec.Command("sh", "-c", command) cmd.Env = append(os.Environ(), "ASCIINEMA_REC=1") master, err := pty.Start(cmd) ``` As you can see the command to run is actually always a subcommand executed in sh. I assume this is ok, as long as you use bash or any other POSIX compliant shell, but that's not the case with fish. I've changed that bit to `cmd := exec.Command("/usr/local/bin/fish", "-c", command)`, compiled it, passed the tests and it works like a charm! Now, I am new to Go but I'd be happy to take a shot on adding another config value to enable fish support, but before I even start it would be good to know if that would be even considered as a feature :-)
kerem closed this issue 2026-03-15 10:08:46 +03:00
Author
Owner

@ku1ik commented on GitHub (Jul 6, 2016):

Hey, it's probably best to not do any more work in the current Go codebase as I'll be releasing new version of asciinema written in Python (https://github.com/asciinema/asciinema/tree/p3) very soon. It's based on the original asciinema implementation (version 0.9.8 to be specific).

Anyway, the new code for running the command is here: github.com/asciinema/asciinema@61feb5908d/asciinema/recorder.py (L17)

I really don't understand why the current solution doesn't work. I am using fish shell myself and didn't notice anything broken (I don't use custom command though so /usr/local/bin/fish is used).

If we expand it to the full command it would be:

sh -c "/usr/local/bin/fish"

or in your case:

sh -c "/usr/local/bin/fish -l"

Why wouldn't sh start fish as a login shell here?

<!-- gh-comment-id:230725998 --> @ku1ik commented on GitHub (Jul 6, 2016): Hey, it's probably best to not do any more work in the current Go codebase as I'll be releasing new version of asciinema written in Python (https://github.com/asciinema/asciinema/tree/p3) very soon. It's based on the original asciinema implementation (version 0.9.8 to be specific). Anyway, the new code for running the command is here: https://github.com/asciinema/asciinema/blob/61feb5908d79f442eecec75dd64a373d85b7bbc5/asciinema/recorder.py#L17 I really don't understand why the current solution doesn't work. I am using fish shell myself and didn't notice anything broken (I don't use custom command though so `/usr/local/bin/fish` is used). If we expand it to the full command it would be: ``` sh -c "/usr/local/bin/fish" ``` or in your case: ``` sh -c "/usr/local/bin/fish -l" ``` Why wouldn't `sh` start `fish` as a login shell here?
Author
Owner

@piotrgo commented on GitHub (Jul 6, 2016):

I think there's no real issue actually. I was playing with it late at night. After your reply I went back to using version from brew and it works as expected :-) I think the reason why I though there's an issue was that I also played with fish functions pretty much at the same time.
At least I had a go at trying to understand go code.
Sorry if I wasted your time.
Cheers,
Piotr

<!-- gh-comment-id:230740528 --> @piotrgo commented on GitHub (Jul 6, 2016): I think there's no real issue actually. I was playing with it late at night. After your reply I went back to using version from brew and it works as expected :-) I think the reason why I though there's an issue was that I also played with fish functions pretty much at the same time. At least I had a go at trying to understand go code. Sorry if I wasted your time. Cheers, Piotr
Author
Owner

@ku1ik commented on GitHub (Jul 6, 2016):

No prob, I'm glad you figured it out 👍

<!-- gh-comment-id:230745263 --> @ku1ik commented on GitHub (Jul 6, 2016): No prob, I'm glad you figured it out 👍
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#740
No description provided.