Skip to content

Commit bba20a2

Browse files
committed
Allow disabling graphical crash handler with --no-crash-dialog
This is mainly for running Picard in CI environments and debugging
1 parent 77bfced commit bba20a2

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

.github/workflows/run-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jobs:
110110
pip install .
111111
- name: Test running installed package
112112
if: runner.os != 'Windows'
113-
run: picard --long-version
113+
run: picard --long-version --no-crash-dialog
114114
- name: Verify sdist package
115115
if: runner.os != 'Windows'
116116
run: |

picard/__init__.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,14 @@ def crash_handler():
9696
a minimal crash dialog to the user.
9797
This function is supposed to be called from inside an except blog.
9898
"""
99+
import sys
100+
101+
# Allow disabling the graphical crash handler for debugging and CI purposes.
102+
if '--no-crash-dialog' in sys.argv:
103+
return
104+
99105
# First try to get traceback information and write it to a log file
100106
# with minimum chance to fail.
101-
import sys
102107
from tempfile import NamedTemporaryFile
103108
import traceback
104109
trace = traceback.format_exc()

picard/tagger.py

+2
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,8 @@ def process_picard_args():
949949
help="do not restore positions and/or sizes")
950950
parser.add_argument("-P", "--no-plugins", action='store_true',
951951
help="do not load any plugins")
952+
parser.add_argument("--no-crash-dialog", action='store_true',
953+
help="disable the crash dialog")
952954
parser.add_argument('-v', '--version', action='store_true',
953955
help="display version information and exit")
954956
parser.add_argument("-V", "--long-version", action='store_true',

scripts/package/macos-package-app.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ fi
8383
# Only test the app if it was codesigned, otherwise execution likely fails
8484
if [ "$CODESIGN" = '1' ]; then
8585
echo "Verify Picard executable works and required dependencies are bundled..."
86-
VERSIONS=$("$APP_BUNDLE/Contents/MacOS/picard-run" --long-version)
86+
VERSIONS=$("$APP_BUNDLE/Contents/MacOS/picard-run" --long-version --no-crash-dialog)
8787
echo "$VERSIONS"
8888
ASTRCMP_REGEX="astrcmp C"
8989
[[ $VERSIONS =~ $ASTRCMP_REGEX ]] || (echo "Failed: Build does not include astrcmp C" && false)

0 commit comments

Comments
 (0)