m4rc3l05
How to check if stdin is a file?
The idea would be to have what pino-pretty does but with deno apis, but then i noticed this issue with the deprecations and started to wonder how would i do it without nodejs apis for deno v2.
So currently not possible then?
20 replies
How to check if stdin is a file?
stdin.isTerminal() does not seem to be what i want, given the example from pino-pretty https://github.com/pinojs/pino-pretty/blob/master/bin.js#L86, they check if stdin is terminal and if stdin is a file and if both are false it means that we are piping to the script and we should do nothing on the first sigint and exit on the next one, allowing to wait for the process being piped to close before closing it self, as explained in https://github.com/pinojs/pino/pull/358#issuecomment-366185875
the
stdin.isTerminal()
answares the 2 point, but the 1 remain still remains, how do we check it in deno v2 without using deprecated methos? currently i am doing !Deno.stdin.isTerminal() && !Deno.fstatSync(Deno.stdin.rid).isFile
bu this will not work for v2 right?20 replies