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

pshw starts with $error populated

Open pcrosthwaite opened this issue 4 years ago • 0 comments

Hi,

I'm trying the following code to run some powershell. It looks to me though that for some reason, when ps.invoke() is called, $error shows that there is a problem. Any ideas why?

const ps = new shell ({ executionPolicy: 'Bypass', noProfile: true, verbose: true}) ps.addCommand( "write-host $error.count")

ps.invoke().then(output => { console.log("test script finished")})

if i inspect the output, $error.count = 1, even though it hasn't done anything.

thanks for your help

pcrosthwaite avatar Apr 05 '20 23:04 pcrosthwaite