Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sometimes, especially when reading large inputs from stdin, we get the following error: ``` node:internal/fs/sync:25 return binding.readFileUtf8(path, stringToFlags(flag)); ^ Error: EAGAIN: resource temporarily unavailable, read at Object.readFileUtf8 (node:internal/fs/sync:25:18) at Object.readFileSync (node:fs:441:19) at /usr/local/lib/node_modules/@watonomous/watcloud-emails/dist/cli/index.js:74:44 at Generator.next (<anonymous>) at /usr/local/lib/node_modules/@watonomous/watcloud-emails/dist/cli/index.js:9:71 at new Promise (<anonymous>) at __awaiter (/usr/local/lib/node_modules/@watonomous/watcloud-emails/dist/cli/index.js:5:12) at Command.<anonymous> (/usr/local/lib/node_modules/@watonomous/watcloud-emails/dist/cli/index.js:69:41) at Command.listener [as _actionHandler] (/usr/local/lib/node_modules/@watonomous/watcloud-emails/node_modules/commander/lib/command.js:542:17) at /usr/local/lib/node_modules/@watonomous/watcloud-emails/node_modules/commander/lib/command.js:1502:14 { errno: -11, code: 'EAGAIN', syscall: 'read' } ``` This appears to be because `process.stdin.fd` only operates on nonblocking mode. This PR accesses `/dev/stdin` directly instead of using `0`. References: - https://stackoverflow.com/a/75948127/4527337
- Loading branch information