Cleanup editing of proc environ
This commit is contained in:
parent
a01dbbdf04
commit
cc7e668ad6
@ -126,7 +126,7 @@ def socket_child_main(exit_code=0, initial_print=''):
|
|||||||
argv=[kitty_exe(), '+runpy', src + 'socket_child_main(initial_print="child ready:")'], cols=cols, env=env, cwd=cwd)
|
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())
|
pty.wait_till(lambda: 'child ready:' in pty.screen_contents())
|
||||||
from kitty.child import environ_of_process
|
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)
|
os.close(pty.master_fd)
|
||||||
|
|
||||||
with self.subTest(msg='test passing of data via cwd, env vars and stdin/stdout redirection'):
|
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
|
#undef fail
|
||||||
|
|
||||||
while (*envp) {
|
while (*envp) {
|
||||||
if (strncmp(*envp, "KITTY_PREWARM_SOCKET_REAL_TTY=", 2) == 0) {
|
char *p = *envp;
|
||||||
char *p = *envp + sizeof("KITTY_PREWARM_SOCKET_REAL_TTY=") - 1;
|
const char *q = "KITTY_PREWARM_SOCKET_REAL_TTY=";
|
||||||
snprintf(p, strlen(p) + 1, "%s", child_tty_name);
|
while (*p && *q && *p == *q) {
|
||||||
|
if (*p == '=') {
|
||||||
|
p++;
|
||||||
|
snprintf(p, strlen(p) + 1, "%s", child_tty_name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
p++; q++;
|
||||||
}
|
}
|
||||||
envp++;
|
envp++;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user