Fix a regression in notify_on_cmd_finish that caused notifications to appear for every command after the first

Fixes #7725
This commit is contained in:
Kovid Goyal
2024-08-16 20:47:52 +05:30
parent 4575dc6b70
commit bb090ccc72
2 changed files with 3 additions and 1 deletions

View File

@@ -138,6 +138,8 @@ Detailed list of changes
- macOS: Bump the minimum required macOS version to Catalina released five years ago.
- Fix a regression in :opt:`notify_on_cmd_finish` that caused notifications to appear for every command after the first (:iss:`7725`)
0.35.2 [2024-06-22]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -1452,13 +1452,13 @@ class Window:
def handle_cmd_end(self, exit_status: str = '') -> None:
if self.last_cmd_output_start_time == 0.:
return
self.last_cmd_output_start_time = 0.
try:
self.last_cmd_exit_status = int(exit_status)
except Exception:
self.last_cmd_exit_status = 0
end_time = monotonic()
last_cmd_output_duration = end_time - self.last_cmd_output_start_time
self.last_cmd_output_start_time = 0.
self.call_watchers(self.watchers.on_cmd_startstop, {
"is_start": False, "time": end_time, 'cmdline': self.last_cmd_cmdline, 'exit_status': self.last_cmd_exit_status})