diff options
author | Florian Bruhin <me@the-compiler.org> | 2022-05-24 16:23:29 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2022-05-24 16:23:29 +0200 |
commit | bd8ca51df4cea889e478393aab2b2d6f06ff1eb3 (patch) | |
tree | c5deb43976666655f17e66ec44271109e11c1f9f | |
parent | e68cc87228cd5af2785a1dae5ac456410f170088 (diff) | |
download | qutebrowser-bd8ca51df4cea889e478393aab2b2d6f06ff1eb3.tar.gz qutebrowser-bd8ca51df4cea889e478393aab2b2d6f06ff1eb3.zip |
herbe: Make sure finished processes are treated as closed
When a herbe notification was right-clicked ("accepted" according to
the herbe readme), it signals that by exiting with exit status 2.
So far, we've only signalled that by emitting click_id to the bridge
(thus letting the website know about it being clicked), but we never
communicated that it was also closed by the same action.
When right-clicking a Discord notification, this meant that the
following happened:
- herbe exits with status 2
- We emit click_id, thus communicating to Discord that the notification
was clicked.
- Discord calls .close() (in JS) on the notification.
- Our on_web_closed gets called and tries to send a SIGUSR1 to herbe to dismiss
the notification.
- However, the herbe process already exited at this point, thus leading
to:
Traceback (most recent call last):
File ".../qutebrowser/browser/webengine/notification.py", line 639, in on_web_closed
os.kill(notification_id, signal.SIGUSR1)
ProcessLookupError: [Errno 3] No such process
If we make it clear that the notification is already gone, and
on_web_closed does not seem to be called at all anymore.
-rw-r--r-- | qutebrowser/browser/webengine/notification.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/qutebrowser/browser/webengine/notification.py b/qutebrowser/browser/webengine/notification.py index e4ad4d763..3571bb24d 100644 --- a/qutebrowser/browser/webengine/notification.py +++ b/qutebrowser/browser/webengine/notification.py @@ -621,18 +621,19 @@ class HerbeNotificationAdapter(AbstractNotificationAdapter): so there's no point. """ if status == QProcess.CrashExit: - return - - if code == 0: + pass + elif code == 0: self.click_id.emit(pid) elif code == 2: - self.close_id.emit(pid) + pass else: proc = self.sender() assert isinstance(proc, QProcess), proc stderr = proc.readAllStandardError() raise Error(f'herbe exited with status {code}: {stderr}') + self.close_id.emit(pid) + @pyqtSlot(QProcess.ProcessError) def _on_error(self, error: QProcess.ProcessError) -> None: if error == QProcess.Crashed: |