reader: Skip FreeBSD directory hack for stdin

This can be triggered on linux with:

```js
import { spawn } from 'child_process';
const shell = spawn('/home/alfa/dev/fish-shell/build-c++/fish', []);
```

Under node 19.8.1.

*No clue* how that happens, but since this is a workaround we shall
skip it.
This commit is contained in:
Fabian Boehm 2023-03-25 20:44:35 +01:00
parent e2579a59ba
commit aa268696bf

View File

@ -4690,7 +4690,9 @@ static int read_ni(parser_t &parser, int fd, const io_chain_t &io) {
}
/* FreeBSD allows read() on directories. Error explicitly in that case. */
if (buf.st_mode & S_IFDIR) {
// XXX: This can be triggered spuriously, so we'll not do that for stdin.
// This can be seen e.g. with node's "spawn" api.
if (fd != STDIN_FILENO && buf.st_mode & S_IFDIR) {
FLOGF(error, _(L"Unable to read input file: %s"), strerror(EISDIR));
return 1;
}