sassman / t-rec-rs

Blazingly fast terminal recorder that generates animated gif images for the web written in rust
https://crates.io/crates/t-rec
GNU General Public License v3.0
980 stars 31 forks source link

Shell does not accept arguments #128

Open inferiorhumanorgans opened 2 years ago

inferiorhumanorgans commented 2 years ago

Arguments on the command line are not passed to the shell executed by t-rec. e.g.

t-rec /usr/local/bin/bash -l This doesn't run, clap tries to gobble up -l.

t-rec -- /usr/local/bin/bash -l This runs but -l is not passed to bash.

t-rec -- "/usr/local/bin/bash -l" This starts, prints a "press ctrl-d to stop recording message", quits, and immediately resets the terminal. As a result you may see the recording message but you won't see the error message.

sassman commented 2 years ago

Thanks for reporting this.

As it seems there are 2 problems here:

  1. the message Press Ctrl+D to end recording appears, even if in that case the thread launching the shell dies.
  2. when calling t-rec '/bin/bash -l' the argument /bin/bash -l is used to start the shell, but somehow -l is considered to be part of the program to start.
inferiorhumanorgans commented 2 years ago

@sassman Actually, the third is that extra arguments are not passed to the command (per the second variant above). Without looking at the code my guess is that you're taking the first positional arg not all of them.

IMO it's probably not worth splitting up a single string as an argument since that means getting into the shell parsing business.