Skip to content

Abort recording if the shell exits #653

@dzuelke

Description

@dzuelke

It would be nice if the playback of a .tape file could be aborted if the shell exits, e.g. due to set -e and a command failing, or even due to an explicit exit.

At the moment, the shell dies in that situation, but the TTY emulator keeps running, so you get a blinking cursor just sitting there until the tape is completed.

The only workaround I could come up with is a check like this after "critical" commands (the name is just to ensure a slightly nicer error message on failure):

Wait@1s /(?<CheckIfShellExited>.)/

But this has to be repeated in any location where a command might fail, and if that command takes a while, then the exact lengths of timeouts become problematic.

Is there a way to detect that the shell has exited, and abort the recording with an error?

Example:

Type "set -e" Enter
Sleep 1000 ms
Type "echo hi" Enter
Sleep 1000 ms
Type "false" Enter
Sleep 1000 ms

Type "Hello?" Enter
Sleep 5000 ms
Type "Anybody home?" Enter
Sleep 5000 ms
Type ":("
Sleep 2000 ms

Produces a 15 second long result:
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions