console: use synchronous write when the process is piped
Fixes: https://github.com/nodejs/node/issues/24992
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines