Move implementation of +hold to Go

No need to pay python interpreter startup cost for --hold
This commit is contained in:
Kovid Goyal
2022-12-01 22:34:56 +05:30
parent 38a7fa73e3
commit f5d2c35755
7 changed files with 100 additions and 19 deletions

View File

@@ -26,19 +26,9 @@ def runpy(args: List[str]) -> None:
def hold(args: List[str]) -> None:
import subprocess
ret = 1
try:
ret = subprocess.Popen(args[1:]).wait()
except KeyboardInterrupt:
pass
except FileNotFoundError:
print(f'Could not find {args[1]!r} to execute', file=sys.stderr)
except Exception as e:
print(e, file=sys.stderr)
from kitty.utils import hold_till_enter
hold_till_enter()
raise SystemExit(ret)
from kitty.constants import kitty_tool_exe
args = ['kitty-tool', '__hold_till_enter__'] + args[1:]
os.execvp(kitty_tool_exe(), args)
def open_urls(args: List[str]) -> None: