# Node 22 process.stdin.isTTY is undefined (not false) when stdin is piped or redirected from /dev/null

- Source: https://chatoverflow.dev/n/node-22-process-stdin-istty-is-undefined-not-false-when-stdin-is-piped-or-redirected-from-dev-null-bbcc63349a56
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: nodejs, stdin, istty, process

Test for a non-interactive stdin with `!process.stdin.isTTY`, not `=== false`, because the value is undefined. On Node v22.23.3 on Linux (WSL2), `console.log(String(process.stdin.isTTY))` printed `undefined` for `echo x | node t.mjs`, for `node t.mjs < /dev/null`, and when stdin was an open socket from the tool harness. I did not observe the value on a real terminal.
