mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-18 14:34:52 +02:00
Correct fix for ignoring BrokenPipeError
This commit is contained in:
@@ -106,6 +106,7 @@ class Boss:
|
|||||||
|
|
||||||
def __init__(self, os_window_id, opts, args, cached_values, new_os_window_trigger):
|
def __init__(self, os_window_id, opts, args, cached_values, new_os_window_trigger):
|
||||||
set_draw_minimal_borders(opts)
|
set_draw_minimal_borders(opts)
|
||||||
|
self.update_check_process = None
|
||||||
self.window_id_map = WeakValueDictionary()
|
self.window_id_map = WeakValueDictionary()
|
||||||
self.startup_colors = {k: opts[k] for k in opts if isinstance(opts[k], Color)}
|
self.startup_colors = {k: opts[k] for k in opts if isinstance(opts[k], Color)}
|
||||||
self.startup_cursor_text_color = opts.cursor_text_color
|
self.startup_cursor_text_color = opts.cursor_text_color
|
||||||
@@ -778,6 +779,7 @@ class Boss:
|
|||||||
def destroy(self):
|
def destroy(self):
|
||||||
self.shutting_down = True
|
self.shutting_down = True
|
||||||
self.child_monitor.shutdown_monitor()
|
self.child_monitor.shutdown_monitor()
|
||||||
|
self.update_check_process = None
|
||||||
del self.child_monitor
|
del self.child_monitor
|
||||||
for tm in self.os_window_map.values():
|
for tm in self.os_window_map.values():
|
||||||
tm.destroy()
|
tm.destroy()
|
||||||
@@ -992,8 +994,6 @@ class Boss:
|
|||||||
from .update_check import process_current_release
|
from .update_check import process_current_release
|
||||||
try:
|
try:
|
||||||
raw = update_check_process.stdout.read().decode('utf-8')
|
raw = update_check_process.stdout.read().decode('utf-8')
|
||||||
except BrokenPipeError:
|
|
||||||
pass
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log_error('Failed to read data from update check process, with error: {}'.format(e))
|
log_error('Failed to read data from update check process, with error: {}'.format(e))
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -96,11 +96,21 @@ def process_current_release(raw):
|
|||||||
notify_new_version(release_version)
|
notify_new_version(release_version)
|
||||||
|
|
||||||
|
|
||||||
|
def run_worker():
|
||||||
|
import time
|
||||||
|
import random
|
||||||
|
time.sleep(random.randint(1000, 4000) / 1000)
|
||||||
|
try:
|
||||||
|
print(get_released_version())
|
||||||
|
except BrokenPipeError:
|
||||||
|
pass # happens if parent process is killed before us
|
||||||
|
|
||||||
|
|
||||||
def update_check(timer_id=None):
|
def update_check(timer_id=None):
|
||||||
try:
|
try:
|
||||||
p = subprocess.Popen([
|
p = subprocess.Popen([
|
||||||
kitty_exe(), '+runpy',
|
kitty_exe(), '+runpy',
|
||||||
'from kitty.update_check import *; import time, random; time.sleep(random.randint(1000, 4000) / 1000); print(get_released_version())'
|
'from kitty.update_check import run_worker; run_worker()'
|
||||||
], stdout=subprocess.PIPE)
|
], stdout=subprocess.PIPE)
|
||||||
except EnvironmentError as e:
|
except EnvironmentError as e:
|
||||||
log_error('Failed to run kitty for update check, with error: {}'.format(e))
|
log_error('Failed to run kitty for update check, with error: {}'.format(e))
|
||||||
|
|||||||
Reference in New Issue
Block a user