child-shell
child-shell copied to clipboard
pshw starts with $error populated
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