How can I make Blender to exit with the same exit code as the python expression? I am running a python expression through blender from the commandline. I want to know if the python expression is executed correctly or not. But Blender always exits with a 0 code. Is there any way to make it exit with the same code as the python expression?

For example I would expect the following command exit with a non-zero code:

"\Program Files\blender foundation\blender\blender.exe" --background --python-expr "2/0"
You will have to put the expr in try and explicitly exit with an error code on exception.

E.g. following exits with exit code 10 (user defined):

"\Program Files\blender foundation\blender\blender.exe" --background --python-expr "exec('import sys\ntry: 2/0\nexcept: sys.exit(10)')"