]> git.kaiwu.me - njs.git/commit
Shell: fixed interactive mode detection for piped stdin.
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 13 Feb 2026 05:31:23 +0000 (21:31 -0800)
committerDmitry Volyntsev <xeioexception@gmail.com>
Fri, 27 Feb 2026 23:44:30 +0000 (15:44 -0800)
commit3b91c6712979f863144979fe0cb2bfb09c8a173e
tree21a29371ec4921a38229c71d40dce00ec619bef1
parent7ab46003dae80bdacc6ece30976a092b60d2dc3e
Shell: fixed interactive mode detection for piped stdin.

Previously, libedit callback API (rl_callback_read_char) was used for
interactive input processing.  Unlike the blocking readline() API, the
callback interface does not work correctly when stdin is a pipe: input
characters are silently dropped and the line handler is never invoked.

The issue was introduced in 4988565c6ea7 (0.8.0).

The fix is to check isatty(STDIN_FILENO) and fall back to the file
processing mode when stdin is not a terminal.
external/njs_shell.c