child-shell icon indicating copy to clipboard operation
child-shell copied to clipboard

Allow and separate stderr output

Open cawoodm opened this issue 4 years ago • 2 comments

It seems impossible currently to receive output from a powershell script which outputs on stderr for example with Write-Error.

Firstly, if any output is on stderr then the promise is rejected unconditionally (invocationHadErrors). Secondly, all output is captured into the same stream.

lib/Shell.js

This script seems to be combining stdout and stderr:

this.streams.stdout.pipe(psOut);
this.streams.stderr.pipe(psOut);

It would be more powerful if one could call a powershell script and not assume that a single error is the end of the script. PowerShell itself offers $ErrorActionPreference="continue" whereby a script can output errors and still continue running.

cawoodm avatar Dec 29 '20 18:12 cawoodm

@cawoodm Liked the idea very much! I'm about to release a new version in the coming days, would you like to help me think of a way to implement this in the new code?

rannn505 avatar Jan 01 '21 14:01 rannn505

Sure. I think we should provide an ErrorActionPreferenceoption and maybe a SeparateStdErroption.

You're moving to TypeScript right?

cawoodm avatar Jan 02 '21 14:01 cawoodm