From: Mark Jamsek Subject: Re: tog: ensure stdin is a tty To: Omar Polo Cc: Stefan Sperling , Game of Trees Date: Tue, 6 Sep 2022 20:09:54 +1000 On 22-09-05 08:13PM, Omar Polo wrote: > On 2022/09/06 04:07:39 +1000, Mark Jamsek wrote: > > On 22-09-03 04:55PM, Omar Polo wrote: > > > On 2022/09/03 15:37:31 +0200, Stefan Sperling wrote: > > > > On Sat, Sep 03, 2022 at 11:24:47PM +1000, Mark Jamsek wrote: > > > > > This was discussed a while back on IRC to handle such things like: > > > > > > > > > > $ tog < /dev/null > > > > > > > > > > ok? > > > > > > > > Should 'return 1' or exit(1) on error, not return GOT_ERR_IO. > > > > > > given the place where that check is, I'd go with an > > > > > > errx(1, "stardand input is not a tty"); > ^^^^^^^^ > > > > > > > otherwise ok for me! > > > > Thanks, stsp and op! Done. > > > > diff refs/heads/main refs/heads/fix/tty > > commit - 3d8e0c5ede1a5654397b63a9f483d875543527d5 > > commit + 7f04ea5dca27cc3e9751803d572f6792dde836d1 > > blob - 9d57af707725df8ed20c18c242b8359ad3a3270c > > blob + 5b813c5e0de32f5883d2349934fb4b0280daa2ed > > --- tog/tog.c > > +++ tog/tog.c > > @@ -8478,6 +8478,9 @@ main(int argc, char *argv[]) > > }; > > char *diff_algo_str = NULL; > > > > + if (!isatty(STDIN_FILENO)) > > + errx(1, "stardand input is not a tty"); > ^^^^^^^^ > > wops, the typo wasn't a requirement! :D lol two too many beers at the terminal I think :) > ok for me! Committed without the typo; thanks, op! -- Mark Jamsek GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68