Open rsmarples opened 6 months ago
I was having issues getting this to run in my Node. I installed Powershell 7 and still got the same errors. Then I tried using the options above and now getting this error: Powershell init has an error!
. Any ideas? Is there a debug mode?
If I remove the options object, I get these errors:
Error: spawn pwsh ENOENT.
Error: Shell took too long to start!.
Whilst I have contributed to this project, I felt that the design is unworkable. To fix the issue and the equally important issue of getting a decent error message when things go wrong would have involved breaking the API to much.
I have created simpler more light weight variant PowerShell-Host which is available as a npm.
child_process:spawn does not throw any error directly as it forks a process Instead, errors are emitted and need to be listened to.
error
is emitted on errors, andspawn
on success. https://nodejs.org/api/child_process.html#event-errorAs such, only the first element of additionalShellNames is considered.
Workaround for vanilla windows without PowerShell-7: