zx
zx copied to clipboard
add postfix option
I'm using zx with powershell, and I noticed that when a command sets an exit code instead of throwing an exception (ex. Azure CLI does this) the exit code doesn't get passed through by default. To resolve this issue I added a $.postfix option:
$.postfix = '; exit $LastExitCode'
await $`az ...` // now throws an exception on failure
I've also added a CLI option and updated the default powershell behavior to include this postfix. These changes work for me but if there is a better way I'd be happy to rework them.
- [x] Tests pass
- [x] Appropriate changes to README are included in PR
- [x] Types updated
@antongolub
This PR would be very helpful for us running cross-platform tests using zx in CI.
@antonmedv does this PR need anything else?
bump
Hey @antonmedv any reason why this was never merged? I still use this change daily, it's great for powershell.
Lets rebase!