зеркало из https://github.com/microsoft/git.git
pager: set LESS=FRSX also on Windows
Previously, this environment variable was set in the pager_preexec callback, which is conditionally-compiled only on Unix, because it is not, and cannot be, called on Windows. With this patch the env member of struct child_process is used to set the environment variable, which also works on Windows. Noticed by Alexey Borzenkov. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
2affea4125
Коммит
25fc1786ab
6
pager.c
6
pager.c
|
@ -21,8 +21,6 @@ static void pager_preexec(void)
|
||||||
FD_ZERO(&in);
|
FD_ZERO(&in);
|
||||||
FD_SET(0, &in);
|
FD_SET(0, &in);
|
||||||
select(1, &in, NULL, &in, NULL);
|
select(1, &in, NULL, &in, NULL);
|
||||||
|
|
||||||
setenv("LESS", "FRSX", 0);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -70,6 +68,10 @@ void setup_pager(void)
|
||||||
pager_argv[2] = pager;
|
pager_argv[2] = pager;
|
||||||
pager_process.argv = pager_argv;
|
pager_process.argv = pager_argv;
|
||||||
pager_process.in = -1;
|
pager_process.in = -1;
|
||||||
|
if (!getenv("LESS")) {
|
||||||
|
static const char *env[] = { "LESS=FRSX", NULL };
|
||||||
|
pager_process.env = env;
|
||||||
|
}
|
||||||
#ifndef __MINGW32__
|
#ifndef __MINGW32__
|
||||||
pager_process.preexec_cb = pager_preexec;
|
pager_process.preexec_cb = pager_preexec;
|
||||||
#endif
|
#endif
|
||||||
|
|
Загрузка…
Ссылка в новой задаче