Skip to content

Error when exiting with ^C under some shells #85

@michaelpj

Description

@michaelpj

If I run bash -c 'cat $(ls | selecta)' and ^C out of the selecta prompt, then I get the following error:

/home/michaelpj/bin/selecta:782:in `block in command': Command failed: "stty 4500:5:bf:8a3b:3:1c:7f:15:4:0:1:ff:11:13:1a:ff:12:f:17:16:ff:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0\n" (RuntimeError)
        from /home/michaelpj/bin/selecta:779:in `pipe'
        from /home/michaelpj/bin/selecta:779:in `command'
        from /home/michaelpj/bin/selecta:772:in `stty'
        from /home/michaelpj/bin/selecta:565:in `restore_tty'
        from /home/michaelpj/bin/selecta:543:in `ensure in block in with_screen'
        from /home/michaelpj/bin/selecta:544:in `block in with_screen'
        from /home/michaelpj/bin/selecta:752:in `call'
        from /home/michaelpj/bin/selecta:752:in `with_tty'
        from /home/michaelpj/bin/selecta:536:in `with_screen'
        from /home/michaelpj/bin/selecta:44:in `main'
        from /home/michaelpj/bin/selecta:791:in `<main>'

If I try to run this in a bash shell directly, then I don't see the error, but my terminal becomes messed up: input stops appearing, but I can still enter commands.

I've tried with --norc --noprofile --noediting --posix, and that doesn't help.

I also see the error when I run zsh -c 'cat $(ls | selecta)', but have no problems running the command directly at a zsh prompt.

I don't see this using sh on my system (which is dash).

I'm sure this is some weird terminal interaction, but I'm afraid I don't have any more leads than that! In general, it seems to only happen when selecta is running inside a command substitution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions