73 Commits

Author SHA1 Message Date
Kovid Goyal
56f45e8b0f
Fix unhandled exceptions not being printed to stderr on macOS when run from launch services and using prewarming 2022-08-16 15:28:07 +05:30
Kovid Goyal
9b1c23987c
Fix stdout line_buffering incorrect when parent kitty instance has its stdout redirected to a file 2022-08-01 19:03:03 +05:30
Kovid Goyal
06f9b73a7b
Workaround mypy bug 2022-08-01 19:03:03 +05:30
Kovid Goyal
7ce2b4c641
Indicate in kitty_run_data we are prewarmed 2022-08-01 19:03:03 +05:30
Kovid Goyal
08c2de541f
Nicer establish_controlling_tty 2022-08-01 19:03:03 +05:30
Kovid Goyal
cb5157f2d1
Nicer implementation of eintr_retry that does not prevent type checking of wrapped functions arguments 2022-08-01 19:03:02 +05:30
Kovid Goyal
4eedf0d36c
macOS needs SIGTTOU SIGTTIN explicitly ignored to allow the supervisor to use TIOCSWINSZ 2022-08-01 19:03:02 +05:30
Kovid Goyal
be458303c5
Debounce WINSZ events 2022-08-01 19:03:02 +05:30
Kovid Goyal
df8800b7ff
tcsetpgrp can raise EINTR despite python claiming to auto retry 2022-08-01 19:03:02 +05:30
Kovid Goyal
9c30cd8891
Use a process supervisor for socket workers
This simplifies the code and also allows SIGTSTP to work as the worker
process is no longer in an orphaned process group.
2022-08-01 19:03:02 +05:30
Kovid Goyal
b78183972c
Report child stop to wrapper process 2022-08-01 19:03:02 +05:30
Kovid Goyal
1c0d1ec8a9
wait for child events explicitly 2022-08-01 19:03:01 +05:30
Kovid Goyal
624e96df9b
wrapper process should exit with signal if prewarmed worker exits with signal 2022-08-01 19:03:01 +05:30
Kovid Goyal
a3f1a44d83
OK I give up I cant get signal delivery to work reliably 2022-08-01 19:03:01 +05:30
Kovid Goyal
9379853d47
Get the SIGINT test working on macOS 2022-08-01 19:03:01 +05:30
Kovid Goyal
45186a17ca
macOS doesnt allow TIOCSWINSZ from any process other than the process connected to the terminal or its parent
So send it over the socket to the zygote and have it resize the
terminal. Sigh.
2022-08-01 19:03:00 +05:30
Kovid Goyal
87d95caae0
Dont bother sending slave fd over the socket as it doesnt help on macOS anyway 2022-08-01 19:03:00 +05:30
Kovid Goyal
9535bc94ff
Use both open and the ioctl to set the controlling terminal 2022-08-01 19:03:00 +05:30
Kovid Goyal
cb78e17594
dont break when socket is pre-closed 2022-08-01 19:03:00 +05:30
Kovid Goyal
285c399ae5
... 2022-08-01 19:03:00 +05:30
Kovid Goyal
6a101c51d2
Close tty_fd in master on fork() rather than on close() 2022-08-01 19:03:00 +05:30
Kovid Goyal
991fbacb99
Fix ttyfd passing 2022-08-01 19:03:00 +05:30
Kovid Goyal
72f3e8cd40
Avoid passing around pty paths, instead send the pty fd 2022-08-01 19:03:00 +05:30
Kovid Goyal
90f3c0f9af
Workaround macOS weirdness 2022-08-01 19:02:59 +05:30
Kovid Goyal
d02598688a
Show full traceback for failures to fork socket child 2022-08-01 19:02:59 +05:30
Kovid Goyal
15aace29a1
Restore python signal handlers in forked workers 2022-08-01 19:02:59 +05:30
Kovid Goyal
806ca2b224
Fix atexit handlers being called in forked children
In particular the atexit handler for random_unix_socket()
2022-08-01 19:02:59 +05:30
Kovid Goyal
8011801549
re-init openssl PRNG when forking for prewarm 2022-08-01 19:02:59 +05:30
Kovid Goyal
62fe467336
... 2022-08-01 19:02:58 +05:30
Kovid Goyal
a6c3c57d40
Test stdio redirection with socket prewarm 2022-08-01 19:02:58 +05:30
Kovid Goyal
de9263a117
Verify uid/gid of connection from a prewarm client 2022-08-01 19:02:58 +05:30
Kovid Goyal
7b7f1ecc54
Add basic tests for socket prewarm 2022-08-01 19:02:58 +05:30
Kovid Goyal
055aae2382
Use correct exit codes for signals 2022-08-01 19:02:58 +05:30
Kovid Goyal
dbb084da7a
Cleanup closing of socket child 2022-08-01 19:02:58 +05:30
Kovid Goyal
8332cd2f79
Avoid needing to call os.getpid() repeatedly 2022-08-01 19:02:58 +05:30
Kovid Goyal
73795b5257
detect when socket child closes its tty 2022-08-01 19:02:58 +05:30
Kovid Goyal
16e59784c6
handle failures to send data over socket gracefully 2022-08-01 19:02:58 +05:30
Kovid Goyal
65a7ec3f85
move socket launch handling into its own function 2022-08-01 19:02:57 +05:30
Kovid Goyal
360ff35061
Better error logging from prewarm zygote 2022-08-01 19:02:57 +05:30
Kovid Goyal
a4883e6d41
Transfer data between ttys 2022-08-01 19:02:57 +05:30
Kovid Goyal
44c9d66dd4
Use a map for pid -> socketchild 2022-08-01 19:02:57 +05:30
Kovid Goyal
c7718d078c
Fix parsing of child pid and exit code 2022-08-01 19:02:57 +05:30
Kovid Goyal
d8f5ccf9e4
Make master tty raw and print error messages with more context 2022-08-01 19:02:57 +05:30
Kovid Goyal
39bb0ecfcf
more work on socket based prewarm 2022-08-01 19:02:57 +05:30
Kovid Goyal
b222ab1bf6
Start work on socket based prewarm 2022-08-01 19:02:57 +05:30
Kovid Goyal
79dec269e1
... 2022-07-16 10:25:18 +05:30
Kovid Goyal
a94a0f3026
Fix fd leak in prewarm zygote 2022-07-03 13:32:09 +05:30
Kovid Goyal
a3d42a90f2
Get rid of os.waitid() since its not present on macOS we cannot rely on it anyway 2022-06-19 18:11:23 +05:30
Kovid Goyal
a27dfd8b7c
Increase the timeout for prewarm I/O on CI 2022-06-14 21:17:28 +05:30
Kovid Goyal
f5976d0d63
Remove unneeded code 2022-06-13 21:33:07 +05:30