doesn't work without stderr
Crocmagnon opened this issue · comments
When piping stdout to tailer, I can't get it to work properly.
$ python3 -m http.server 9300 | tailer
::ffff:127.0.0.1 - - [30/Jun/2023 10:22:13] "GET / HTTP/1.1" 200 -
::ffff:127.0.0.1 - - [30/Jun/2023 10:22:17] "GET / HTTP/1.1" 200 -
However, when piping stdout AND stderr, it seems to work as expected:
$ python3 -m http.server 9300 2>&1 | tailer
::ffff:127.0.0.1 - - [30/Jun/2023 10:23:48] "GET / HTTP/1.1" 200 -
2023-06-30 10:23:49 3.1s ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
::ffff:127.0.0.1 - - [30/Jun/2023 10:23:52] "GET / HTTP/1.1" 200 -
::ffff:127.0.0.1 - - [30/Jun/2023 10:23:52] "GET / HTTP/1.1" 200 -
::ffff:127.0.0.1 - - [30/Jun/2023 10:23:53] "GET / HTTP/1.1" 200 -
::ffff:127.0.0.1 - - [30/Jun/2023 10:23:54] "GET / HTTP/1.1" 200 -
2023-06-30 10:23:55 5.4s ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
OS: darwin - macOS 13.4.1 (22F82)
architecture: arm64 (M1 chip)
@Crocmagnon it's working as expected because http.server
module logs to stderr
. In your terminal you'll see both stdout
and stderr
because both of them are written to /dev/tty
. Just piping with |
redirects stdout
(1>
by default) to another application's stdin
.
To prevent this, a subcommand can be added to tailer
like tailer exec "cmd"
as a new feature.
Oh sorry I totally ignored that http.server
logged on stderr!
In this case then this issue is null and void 🤗