Search code examples
node.jsstreamforkchild-processstdio

When to use property of {silent : false|true} in Node.js


I am learning streams, child processes in Node.js, I am Windows user since childhood, had nothing to do with Unix/Linux nor C family lang, etc. which means I had none of conceptional knowledge before , so please no judge .

I faced and option of {silent: boolean} for child_process.fork() | (default: false)

Note : stdio array variant overrides {silent : boolean}

My question: besides being overwritten , does any variant of stdio (shown in screenshotted table below) have some equivalent for silent property , if property of silent would be used instead of stdio option ?

AFAIK , fork()'s stdio: [0,1,2, ipc] should be equivalent of {silent: true} [as answered hereby by Neil] , but keep in mind I may be mistaken so clarification would be highly appreciated !

String Value
"ignore" ["ignore", "ignore", "ignore"]
"pipe" ["pipe", "pipe", "pipe"]
"inherit" [process.stdin, process.stdout, process.stderr] or [0, 1, 2]

Solution

  • Setting stdio to "pipe" is equivalent to setting silent to true, and setting stdio to "inherit" is equivalent to setting silent to false.