rannn505 / child-shell

Node.js bindings 🔗 for shell
http://rannn505.github.io/child-shell/
MIT License
299 stars 71 forks source link

pshw starts with $error populated #114

Open pcrosthwaite opened 4 years ago

pcrosthwaite commented 4 years ago

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