Merge pull request #3905 from urbit/jb/notty

vere: print error and exit if stdin is not a tty
This commit is contained in:
Joe Bryan 2020-11-08 18:13:19 -08:00 committed by GitHub
commit c7579e9e2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -147,6 +147,12 @@ u3_term_log_init(void)
{ {
uty_u->fid_i = 0; // stdin, yes we write to it... uty_u->fid_i = 0; // stdin, yes we write to it...
if ( !isatty(uty_u->fid_i) ) {
fprintf(stderr, "vere: unable to initialize terminal (not a tty)\r\n"
" use -t to disable interactivity\r\n");
u3_king_bail();
}
uv_pipe_init(u3L, &(uty_u->pop_u), 0); uv_pipe_init(u3L, &(uty_u->pop_u), 0);
uv_pipe_open(&(uty_u->pop_u), uty_u->fid_i); uv_pipe_open(&(uty_u->pop_u), uty_u->fid_i);
} }