mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-21 03:27:55 +03:00
Cleanup editing of proc environ
This commit is contained in:
parent
a01dbbdf04
commit
cc7e668ad6
@ -126,7 +126,7 @@ def wait_for_death(exit_code, timeout=5):
|
||||
argv=[kitty_exe(), '+runpy', src + 'socket_child_main(initial_print="child ready:")'], cols=cols, env=env, cwd=cwd)
|
||||
pty.wait_till(lambda: 'child ready:' in pty.screen_contents())
|
||||
from kitty.child import environ_of_process
|
||||
self.assertIn('/', environ_of_process(pty.child_pid).get('KITTY_PREWARM_SOCKET_REAL_TTY'))
|
||||
self.assertIn('/', environ_of_process(pty.child_pid).get('KITTY_PREWARM_SOCKET_REAL_TTY', ''))
|
||||
os.close(pty.master_fd)
|
||||
|
||||
with self.subTest(msg='test passing of data via cwd, env vars and stdin/stdout redirection'):
|
||||
|
@ -702,9 +702,15 @@ use_prewarmed_process(int argc, char *argv[], char *envp[]) {
|
||||
#undef fail
|
||||
|
||||
while (*envp) {
|
||||
if (strncmp(*envp, "KITTY_PREWARM_SOCKET_REAL_TTY=", 2) == 0) {
|
||||
char *p = *envp + sizeof("KITTY_PREWARM_SOCKET_REAL_TTY=") - 1;
|
||||
snprintf(p, strlen(p) + 1, "%s", child_tty_name);
|
||||
char *p = *envp;
|
||||
const char *q = "KITTY_PREWARM_SOCKET_REAL_TTY=";
|
||||
while (*p && *q && *p == *q) {
|
||||
if (*p == '=') {
|
||||
p++;
|
||||
snprintf(p, strlen(p) + 1, "%s", child_tty_name);
|
||||
break;
|
||||
}
|
||||
p++; q++;
|
||||
}
|
||||
envp++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user