macOS: Fix a regression in the previous release that caused kitty to fail to run after an unclean shutdown/crash

When porting the single instance code to C I forgot to port the lock
file usage.

Fixes #7846
This commit is contained in:
Kovid Goyal
2024-09-15 10:05:18 +05:30
parent 5a77ea64d0
commit d1bdbddbfc
5 changed files with 80 additions and 21 deletions

View File

@@ -485,16 +485,7 @@ def _main() -> None:
if cli_opts.single_instance:
si_data = os.environ.pop('KITTY_SI_DATA', '')
if si_data:
import atexit
fdnum, sep, socket_path = si_data.partition(':')
talk_fd = int(fdnum)
def cleanup_si() -> None:
with suppress(OSError):
os.close(talk_fd)
with suppress(OSError):
if sep and socket_path:
os.unlink(socket_path)
atexit.register(cleanup_si)
talk_fd = int(si_data)
bad_lines: list[BadLine] = []
opts = create_opts(cli_opts, accumulate_bad_lines=bad_lines)
setup_environment(opts, cli_opts)