Skip to content

Commit e706751

Browse files
committed
qtvcp: don't pop a modal error dialog when headless
The excepthook shows a modal QMessageBox for uncaught exceptions. Headless (offscreen/CI) nobody can dismiss it, so it blocks forever; if the error is during construction it hangs before SIGTERM is armed and qtdragon-quit times out. When offscreen (or no QApplication), log the traceback, run shutdown, and exit instead. Interactive path unchanged.
1 parent 77e9f58 commit e706751

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/emc/usr_intf/qtvcp/qtvcp.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,21 @@ def excepthook(self, exc_type, exc_obj, exc_tb):
556556
+ "information may be useful in troubleshooting:\n"
557557
+ 'LinuxCNC Version : %s\n'% self.INFO.LINUXCNC_VERSION)
558558

559+
# Headless/offscreen (e.g. CI): nobody can dismiss a modal dialog,
560+
# so msg.exec_() below would block forever. Report the error the
561+
# normal way (stderr + log + non-zero exit) and quit instead of
562+
# popping a dialog; the error is still visible, just not modal.
563+
app = QtWidgets.QApplication.instance()
564+
if app is None or app.platformName() == 'offscreen':
565+
sys.stderr.write(''.join(lines))
566+
sys.stderr.flush()
567+
LOG.critical("Qtvcp error (headless):\n{}".format(''.join(lines)))
568+
try:
569+
self.shutdown()
570+
except Exception:
571+
pass
572+
os._exit(1)
573+
559574
msg = QtWidgets.QMessageBox()
560575
msg.setIcon(QtWidgets.QMessageBox.Critical)
561576
msg.setText(self._message)

0 commit comments

Comments
 (0)