Skip to content
Myr

Fix missing program from file

Before adoption: this commit came in with the history the project adopted, so no landing records it.

When jq is not supplied with a program, it usually exits with an error and usage text, except for when jq is not connected to a TTY (i.e., not interactive), in which case a default program of `.` is used. Combined with `-f`, it then tries to read `.` as the filename. $ jq jq - commandline JSON processor [version 1.7.1] … $ jq -f jq - commandline JSON processor [version 1.7.1] … $ jq | cat ^C $ jq -f | cat jq: Could not open .: It's a directory

authored by Thalia Archibald · committed by Emanuele Torre · parent 0558e77 · Browse files · 1 file+1 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−1 removed

  • other:+1 added−1 removed

1 file+1 added−1 removed

modified:src/main.c+1 added-1 removed
585 unmodified lines
586 else587 jq_set_attr(jq, jv_string("VERSION_DIR"), jv_string_fmt("%.*s-master", (int)(strchr(JQ_VERSION, '-') - JQ_VERSION), JQ_VERSION));588589#ifdef USE_ISATTY590 if (!program && (!isatty(STDOUT_FILENO) || !isatty(STDIN_FILENO)))590 if (!program && !(options & FROM_FILE) && (!isatty(STDOUT_FILENO) || !isatty(STDIN_FILENO)))591 program = ".";592#endif593594 if (!program) usage(2, 1);
124 unmodified lines