Replies: 1 comment
-
Your script exits before getting to the last print because the You could try to catch the exception and access the exit code like this: try:
app()
except SystemExit as e:
print(f"Exited with exit code {e.code}") But a better approach might be to use the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First Check
Commit to Help
Example Code
Description
Hello,
I have build a CLI with Typer that do some tasks. I have to schedule task execution (with cron for exemple) but for scheduled task, i want to redirect all output (stdin & stderr) to logfile. SO, i have created a python script that import my Typer app "app" and launch it after stdin/stderr redirection
Now, i must retrieve "app" return code to send an alert if this is not 0. How could i do that ?
Thanks
Operating System
Linux
Operating System Details
No response
Typer Version
0.9.0
Python Version
Python 3.8.16
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions