Are there any supported way to abort a running sta...
# general
a
Are there any supported way to abort a running stack immediately from the stack itself? Previously, I have just used exit (in Python), but after we switched to inline stacks, this does not work - the process just hangs until terminated.
b
See here, there’s an error log which is fatal https://www.pulumi.com/docs/intro/concepts/logging/
a
It just adds an error. It does not stop the current update.
b
yep, that’s my misunderstanding, looks like the docs aren’t accurate. I’m following up internally. Re: your issue, do you have a repro?
a
Hmm.. I could make one. But any inline stack that calls exit(1) seems to be in problems. I also tried with pulumi.errors.RunError() but it doesn't about the execution like exit, but first applies the new world view, which is exactly the opposite of what I want 🙂
b
some smart Python people just told me to tell you to try
Copy code
raise Exception("I want my program to end")
a
Will do...
Thanks. I got it to work. I had to do a little more to look nice - otherwise I would get log exception traces in the log, which I didn't want. So: • I used a try-catch around the inline command to convert SystemExit to a new exception with a specific text
• and I caught CommandError from stack.up and stack.preview to filter for the specific text