What is the best way to catch an error with the Pu...
# general
g
What is the best way to catch an error with the Pulumi CLI when running "pulumi stack select" so I can run "pulumi stack init" if it fails?
v
I would say wrap over it with some tooling that uses createOrSelectStack: https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/pulumi/automation/#LocalWorkspace-createOrSelectStack
If you need to do it in the shell,
pulumi stack select -s <stack>
will return non-zero if it can't select the stack. Check for non-zero and init as needed.