Kovid Goyal
6c7a8f8fa9
Ensure usage of __attribute__(cleanup) never frees un-initialized memory
...
Use macros that take an initializer parameter to, thereby ensuring the
variable to be cleaned up is always initialized.
2023-08-07 12:24:18 +05:30
Kovid Goyal
59b47a3a8f
A facility to easily have child programs print to kitty stdout
...
Works better than the kitty-print DCS escape code as that tends to get
interleaved with other writes to the tty since the loop infrastructure
writes in a separate I/O thread.
2023-07-30 19:49:44 +05:30
olzhasar
d0a5d1b3a4
Fix misspellings
2023-06-14 03:39:53 +06:00
Kovid Goyal
45b0788f28
Dont rely on existence of sh to report exec failure
2023-01-14 16:03:34 +05:30
Kovid Goyal
bc73273cb3
...
2023-01-14 15:58:26 +05:30
Kovid Goyal
bcd78c3940
Fix a regression that caused kitty not to restore SIGPIPE after python nukes it when launching children. Affects bash which does not sanitize its signal mask.
...
Fixes #5500
2022-09-13 07:51:32 +05:30
Kovid Goyal
89a0c04d19
Fix exec in prewarm forked process sometimes inheriting env vars from grandparent process
2022-08-30 19:03:32 +05:30
Kovid Goyal
08c2de541f
Nicer establish_controlling_tty
2022-08-01 19:03:03 +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
feb96f1be8
Use O_CLOEXEC for temp ctty fds
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
72f3e8cd40
Avoid passing around pty paths, instead send the pty fd
2022-08-01 19:03:00 +05:30
Kovid Goyal
b222ab1bf6
Start work on socket based prewarm
2022-08-01 19:02:57 +05:30
Kovid Goyal
628246c3da
Workaround for python 3.8 that doesnt have the CLD_* constants
2022-06-13 19:22:37 +05:30
Kovid Goyal
47d482dca9
Clear signal handlers when running processes
2022-06-08 17:50:42 +05:30
Kovid Goyal
76531d2f7a
Python wrapper function to establish controlling tty
2022-06-05 15:36:05 +05:30
Kovid Goyal
ad576c333c
Also restore signal handlers for SIGUSR1 and SIGUSR2
2022-06-04 15:15:39 +05:30
Kovid Goyal
2c3a7b5f41
Restore a couple more signal handlers that python nukes
2022-06-04 14:30:08 +05:30
Kovid Goyal
cb01b5ee44
DRYer
2022-06-03 21:38:49 +05:30
Kovid Goyal
3ff8cc58e1
Ignore invalid unicode condepoints in command lines
2021-11-14 11:59:02 +05:30
Kovid Goyal
be34af4555
Remove inline from .c files
...
It is ignored by compilers and hides unused static functions
2021-08-03 09:11:17 +05:30
Kovid Goyal
d55fde9eea
Use EINTR safe wrappers for open() and shm_open()
2021-01-31 07:02:11 +05:30
Kovid Goyal
72d193e852
Fix python3.7 fork registration not working
2020-12-31 10:38:26 +05:30
Kovid Goyal
392f576d07
Instrument safe_close() to make it easy to see where an fd is closed from
2020-07-14 20:18:04 +05:30
Rafael Kitover
328f569c16
Fix child spawn on FreeBSD.
...
Fix typo: "#ifdef TIOCSTTY" -> "#ifdef TIOCSCTTY"
Include standard header sys/ioctl.h for ioctl(), needed on MacOS.
Include standard header termios.h for TIOCSCTTY.
Fixes this error on spawn of child shell process:
bash: cannot set terminal process group (-1): Inappropriate ioctl for
device
bash: no job control in this shell
Tested on FreeBSD and Linux.
- Fix #2529
Signed-off-by: Rafael Kitover <rkitover@gmail.com >
2020-05-23 12:21:57 +00:00
Kovid Goyal
5521d6b623
Reset the sigprocmask and signal handlers when launching child processes. Fixes #1806
2019-07-18 09:26:31 +05:30
Kovid Goyal
c848c3ee0d
Use an interrupt-safe close()
2019-07-05 14:39:07 +05:30
Luflosi
0e2a5c63c6
Convert some tabs to spaces
2019-02-02 22:08:32 +01:00
Kovid Goyal
9c4230ad9c
Add a comment for why we reset SIGPIPE
2018-12-20 09:29:09 +05:30
Kovid Goyal
056c2c12bb
Explicitly reset the SIGPIPE handler in child processes
...
Fixes #1253
2018-12-20 09:06:21 +05:30
Kovid Goyal
b9a93b68c4
...
2018-09-07 11:37:33 +05:30
Kovid Goyal
e3728942dc
Fix a small memory leak when creating a new child process
2018-09-07 11:35:00 +05:30
Kovid Goyal
05b817f5f5
Micro-optimization
2018-08-04 20:34:12 +05:30
Kovid Goyal
eb2ec1833c
Use a pipe rather than a signal to wait for terminal ready
...
Simpler code, more robust since there is no longer a race between the
installation of the signal handler and the dispatch of the signal
2018-08-04 20:24:06 +05:30
Kovid Goyal
28447d3389
Only launch child processes after window size is available in the termios structure
...
The delay is minimal ~ 1ms and there are apparently some applications
such as kakoune that rely on the window size being available on startup.
Since kitty always sizes windows with some size on startup, we can
afford to wait.
Fixes #786
2018-08-04 09:19:11 +05:30
Kovid Goyal
892637683c
Fix controlling terminal not being set on BSD
...
Fixes #764
2018-07-29 13:48:14 +05:30
Kovid Goyal
c2679eff9a
Fix compiler warning
...
The compiler warning is harmless, since we exec immediately after
using the const char* but since I have a no warning policy...
2018-06-30 18:15:08 +05:30
Kovid Goyal
8db838da9f
macOS: Fix shell not starting in login mode on some computers. Fixes #247
2018-03-05 13:30:09 +05:30
Kovid Goyal
db92af68e9
Fix a couple of typos
2018-01-08 13:54:08 +05:30
Kovid Goyal
f06f871dfc
Handle fork() failures more gracefully
2018-01-05 13:57:49 +05:30
Kovid Goyal
e03c713294
Remove a few more signal unsafe function calls between fork() and exec()
2018-01-05 00:24:15 +05:30
Kovid Goyal
aa107956f9
...
2018-01-04 23:55:03 +05:30
Kovid Goyal
d725578e1b
Silence spurious compiler warning
2018-01-04 23:54:35 +05:30
Kovid Goyal
239eb8202b
Move fork()+exec() of child processes into C
...
By avoiding python in the child process before exec we ensure that
malloc and other unsafe to use after fork functions are not used.
Should also mean that less pages will need to be copied into thec hild
process, leading to marginally faster startups.
2018-01-04 23:19:09 +05:30