aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonmain.py
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-09-22 14:49:14 -0400
committerEli Schwartz <eschwartz@archlinux.org>2022-09-22 15:24:57 -0400
commit389b2f6785a0e281e20205689d2a5729e4378174 (patch)
tree2d67c309893393457e1862fde33299e71aab5011 /mesonbuild/mesonmain.py
parent28103614efb8197bc35e2e0dc9ab97bb42bd951d (diff)
downloadmeson-389b2f6785a0e281e20205689d2a5729e4378174.zip
meson-389b2f6785a0e281e20205689d2a5729e4378174.tar.gz
meson-389b2f6785a0e281e20205689d2a5729e4378174.tar.bz2
fix regression in logging runpython errors
In commit fa044e011d5d7a3525c9b3f2acfe1cbf4a0a96a1 we caught OSError and started emitting a special error message disclaiming that it probably isn't Meson's fault, and skipping the generic "This is a meson bug and should be reported" handler. But, we no longer did this after verifying that the command *isn't* runpython, so arbitrary scripts that raised OSError would start saying stuff about Meson, which was wrong. Start checking for runpython first.
Diffstat (limited to 'mesonbuild/mesonmain.py')
-rw-r--r--mesonbuild/mesonmain.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
index a6d33ef..fed1e56 100644
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -49,7 +49,9 @@ def errorhandler(e, command):
raise e
traceback.print_exc()
- if isinstance(e, OSError):
+ if command == 'runpython':
+ return 2
+ elif isinstance(e, OSError):
error_msg = os.linesep.join([
"Unhandled python exception",
f"{e.strerror} - {e.args}",
@@ -58,13 +60,12 @@ def errorhandler(e, command):
mlog.exception(error_msg)
return e.errno
else: # Exception
- if command != 'runpython':
- msg = 'Unhandled python exception'
- if all(getattr(e, a, None) is not None for a in ['file', 'lineno', 'colno']):
- e = MesonBugException(msg, e.file, e.lineno, e.colno) # type: ignore
- else:
- e = MesonBugException(msg)
- mlog.exception(e)
+ msg = 'Unhandled python exception'
+ if all(getattr(e, a, None) is not None for a in ['file', 'lineno', 'colno']):
+ e = MesonBugException(msg, e.file, e.lineno, e.colno) # type: ignore
+ else:
+ e = MesonBugException(msg)
+ mlog.exception(e)
return 2
# Note: when adding arguments, please also add them to the completion