mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-20 15:35:03 +02:00
Report invalid effective listen_on as a bad config error
This commit is contained in:
@@ -352,6 +352,7 @@ class Boss:
|
|||||||
self.os_window_death_actions: Dict[int, Callable[[], None]] = {}
|
self.os_window_death_actions: Dict[int, Callable[[], None]] = {}
|
||||||
self.cursor_blinking = True
|
self.cursor_blinking = True
|
||||||
self.shutting_down = False
|
self.shutting_down = False
|
||||||
|
self.misc_config_errors: List[str] = []
|
||||||
talk_fd = getattr(single_instance, 'socket', None)
|
talk_fd = getattr(single_instance, 'socket', None)
|
||||||
talk_fd = -1 if talk_fd is None else talk_fd.fileno()
|
talk_fd = -1 if talk_fd is None else talk_fd.fileno()
|
||||||
listen_fd = -1
|
listen_fd = -1
|
||||||
@@ -367,9 +368,8 @@ class Boss:
|
|||||||
try:
|
try:
|
||||||
listen_fd, self.listening_on = listen_on(args.listen_on)
|
listen_fd, self.listening_on = listen_on(args.listen_on)
|
||||||
except Exception:
|
except Exception:
|
||||||
log_error(f'Invalid listen_on setting: {args.listen_on}, ignoring')
|
self.misc_config_errors.append(f'Invalid listen_on={args.listen_on}, ignoring')
|
||||||
import traceback
|
log_error(self.misc_config_errors[-1])
|
||||||
traceback.print_exc()
|
|
||||||
self.child_monitor = ChildMonitor(
|
self.child_monitor = ChildMonitor(
|
||||||
self.on_child_death,
|
self.on_child_death,
|
||||||
DumpCommands(args) if args.dump_commands or args.dump_bytes else None,
|
DumpCommands(args) if args.dump_commands or args.dump_bytes else None,
|
||||||
@@ -2633,7 +2633,7 @@ class Boss:
|
|||||||
assert isinstance(b, int)
|
assert isinstance(b, int)
|
||||||
dbus_notification_created(a, b)
|
dbus_notification_created(a, b)
|
||||||
|
|
||||||
def show_bad_config_lines(self, bad_lines: Iterable[BadLine]) -> None:
|
def show_bad_config_lines(self, bad_lines: Iterable[BadLine], misc_errors: Iterable[str] = ()) -> None:
|
||||||
|
|
||||||
def format_bad_line(bad_line: BadLine) -> str:
|
def format_bad_line(bad_line: BadLine) -> str:
|
||||||
return f'{bad_line.number}:{bad_line.exception} in line: {bad_line.line}\n'
|
return f'{bad_line.number}:{bad_line.exception} in line: {bad_line.line}\n'
|
||||||
@@ -2647,7 +2647,10 @@ class Boss:
|
|||||||
if file:
|
if file:
|
||||||
a(f'In file {file}:')
|
a(f'In file {file}:')
|
||||||
[a(format_bad_line(x)) for x in groups[file]]
|
[a(format_bad_line(x)) for x in groups[file]]
|
||||||
|
if misc_errors:
|
||||||
|
a('In final effective configuration:')
|
||||||
|
for line in misc_errors:
|
||||||
|
a(line)
|
||||||
msg = '\n'.join(ans).rstrip()
|
msg = '\n'.join(ans).rstrip()
|
||||||
self.show_error(_('Errors parsing configuration'), msg)
|
self.show_error(_('Errors parsing configuration'), msg)
|
||||||
|
|
||||||
|
|||||||
@@ -269,8 +269,9 @@ def _run_app(opts: Options, args: CLIOptions, bad_lines: Sequence[BadLine] = ())
|
|||||||
wincls, wstate, load_all_shaders, disallow_override_title=bool(args.title))
|
wincls, wstate, load_all_shaders, disallow_override_title=bool(args.title))
|
||||||
boss = Boss(opts, args, cached_values, global_shortcuts)
|
boss = Boss(opts, args, cached_values, global_shortcuts)
|
||||||
boss.start(window_id, startup_sessions)
|
boss.start(window_id, startup_sessions)
|
||||||
if bad_lines:
|
if bad_lines or boss.misc_config_errors:
|
||||||
boss.show_bad_config_lines(bad_lines)
|
boss.show_bad_config_lines(bad_lines, boss.misc_config_errors)
|
||||||
|
boss.misc_config_errors = []
|
||||||
try:
|
try:
|
||||||
boss.child_monitor.main_loop()
|
boss.child_monitor.main_loop()
|
||||||
finally:
|
finally:
|
||||||
|
|||||||
Reference in New Issue
Block a user