mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-22 00:08:04 +02:00
Eureka! Figured out why libedit is breaking in prewarm on macOS via launchd
The prewarm zygote imports the world. shell.py had a top level import for readline. Which means readline was being imported pre-fork. And of course as is traditional with Apple libedit is not fork safe. Probably because it initializes its internal IO routines based on the stdio handles at time of import which are the handles kitty gets from launchd
This commit is contained in:
@@ -476,15 +476,6 @@ def main(args: List[str]) -> Response:
|
||||
loop.loop(phandler)
|
||||
return {'items': items, 'response': phandler.response}
|
||||
|
||||
rd = getattr(sys, 'kitty_run_data')
|
||||
if 'prewarmed' in rd and 'launched_by_launch_services' in rd:
|
||||
# bloody libedit doesnt work in the prewarmed process run from launch
|
||||
# services for reasons I really dont care enough to investigate
|
||||
loop = Loop()
|
||||
phandler = Password(cli_opts, prompt, is_password=False, initial_text=cli_opts.default or '')
|
||||
loop.loop(phandler)
|
||||
return {'items': items, 'response': phandler.response}
|
||||
|
||||
import readline as rl
|
||||
readline = rl
|
||||
from kitty.shell import init_readline
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
from typing import Any, Callable, Dict, Generator, Optional, Sequence, Tuple
|
||||
|
||||
from kitty.fast_data_types import wcswidth
|
||||
@@ -149,9 +148,6 @@ class PathCompleter:
|
||||
|
||||
|
||||
def get_path(prompt: str = '> ') -> str:
|
||||
rd = getattr(sys, 'kitty_run_data')
|
||||
if 'prewarmed' in rd and 'launched_by_launch_services' in rd:
|
||||
return input(prompt)
|
||||
return PathCompleter(prompt).input()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user