1

I am working with windows using powershell as my terminal. I have an extremely simple nodejs app that uses bunyan. When run it produces the following output:

C:\dev\proj\bunyanTest> node bunyanTest.js
{"name":"name","hostname":"computer","pid":14032,"level":30,"msg":"Test...","time":"2021-03-02T16:41:46.826Z","v":0}
C:\dev\proj\bunyanTest> 

Note that the program terminates immediately.

I want to pipe this output so that it is pretty-printed. I have done the following:

C:\dev\proj\bunyanTest> npm install --global bunyan
.
.
. npm successfully installs bunyan globally
.
.
C:\dev\proj\bunyanTest> node bunyanTest.js | bunyan

Unfortunately this results in no output, no termination (I need to hit ctrl+c to terminate).

The bunyan docs demonstrate using the local bunyan installation (in node_modules):

C:\dev\proj\bunyanTest> node bunyanTest.js | ./node_modules/.bin/bunyan

But for me this produces the same empty result (no output, no termination).

How can I get my log pretty-printed?

(Is my source code relevant? It seems like all that should matter is the output.)

Gershom Maes
  • 7,358
  • 2
  • 35
  • 55

1 Answers1

0

Windows powershell doesn't support the pipe operator (|) with streaming output. That's why this wasn't working.

Gershom Maes
  • 7,358
  • 2
  • 35
  • 55