feat(quickfix): support -q - to read 'errorfile' from stdin (#27303)

Note that this only works when stdin is a pipe.
This commit is contained in:
zeertzjq
2024-02-02 21:17:37 +08:00
committed by GitHub
parent 1bf645918e
commit e98decf9a6
6 changed files with 90 additions and 23 deletions

View File

@@ -1065,7 +1065,9 @@ static int qf_setup_state(qfstate_T *pstate, char *restrict enc, const char *res
}
if (efile != NULL
&& (pstate->fd = os_fopen(efile, "r")) == NULL) {
&& (pstate->fd = (strequal(efile, "-")
? fdopen(os_open_stdin_fd(), "r")
: os_fopen(efile, "r"))) == NULL) {
semsg(_(e_openerrf), efile);
return FAIL;
}