execa icon indicating copy to clipboard operation
execa copied to clipboard

Question on stdin and stderr

Open TrevTheDev opened this issue 6 years ago • 1 comments

Node doesn't return stdin and stderr data sequentially - unlike the terminal. So stdin data may be returned before previous stderr data. I've looked at your code to see how you handle that - but it seems that your code doesn't account for that?

One workaround is to force all data into either stdin or stderr as this forces sequential return.

TrevTheDev avatar Dec 19 '19 02:12 TrevTheDev

Hi @TrevTheDev,

Do you mean stdout and stderr? My answer below assumes that you meant stdout instead of stdin.

I am not sure I understand what you mean. Regardless of Node.js, in any process, stdout and stderr are separate. In some processes such as terminals, they redirect to the same file (for example the terminal), leading them to be interleaved in a single stream.

Execa inherits most of its behavior related to stdin, stdout and stderr to core Node.js child_process. We also offer an all option for merging stdout and stderr into a single stream.

ehmicky avatar Dec 19 '19 09:12 ehmicky

Closing as stale.

ehmicky avatar Dec 18 '23 03:12 ehmicky