I am trying to execute child_process synchronously in node.js (Yes, I know this is bad, I have a good reason) and get any output on stdout, but I cannot figure out how to do this ...
I found this SO: node.js entry to execute the system command synchronously , which describes how to use the library (node -ffi) to execute the command, and this works fine, but the only thing I can get is the process exit code. Any data that the command executes is sent directly to stdout - how to do it?
> run('whoami') username 0
in other words, username is echoed for stdout, the result of run is 0 .
I would understand a lot how to read stdout
Mark Kahn Aug 24 2018-11-21T00: 00Z
source share