mirror of
https://github.com/git/git.git
synced 2026-04-02 04:50:12 +02:00
Windows: Better support PAGER settings with spaces in the path
On Windows, the pager was always run via a shell, which is not the case on Unix, where the shell variant was only used as a fallback. Thus, setting the pager, for example, like this: PAGER="C:/Program Files/msys/bin/less" would fail; an extra set of quotes is needed: PAGER="\"C:/Program Files/msys/bin/less\"" With this patch the former setting works as well. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
This commit is contained in:
committed by
Johannes Sixt
parent
a094080e8e
commit
ccd3859ceb
16
pager.c
16
pager.c
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
static int spawned_pager;
|
static int spawned_pager;
|
||||||
|
|
||||||
#ifndef __MINGW32__
|
|
||||||
static void pager_preexec(void)
|
static void pager_preexec(void)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -24,7 +23,6 @@ static void pager_preexec(void)
|
|||||||
|
|
||||||
setenv("LESS", "FRSX", 0);
|
setenv("LESS", "FRSX", 0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static const char *pager_argv[] = { "sh", "-c", NULL, NULL };
|
static const char *pager_argv[] = { "sh", "-c", NULL, NULL };
|
||||||
static struct child_process pager_process;
|
static struct child_process pager_process;
|
||||||
@@ -68,13 +66,15 @@ void setup_pager(void)
|
|||||||
|
|
||||||
/* spawn the pager */
|
/* spawn the pager */
|
||||||
pager_argv[2] = pager;
|
pager_argv[2] = pager;
|
||||||
pager_process.argv = pager_argv;
|
|
||||||
pager_process.in = -1;
|
|
||||||
#ifndef __MINGW32__
|
|
||||||
pager_process.preexec_cb = pager_preexec;
|
pager_process.preexec_cb = pager_preexec;
|
||||||
#endif
|
pager_process.argv = &pager_argv[2];
|
||||||
if (start_command(&pager_process))
|
pager_process.in = -1;
|
||||||
return;
|
if (start_command(&pager_process)) {
|
||||||
|
pager_process.argv = pager_argv;
|
||||||
|
pager_process.in = -1;
|
||||||
|
if (start_command(&pager_process))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* original process continues, but writes to the pipe */
|
/* original process continues, but writes to the pipe */
|
||||||
dup2(pager_process.in, 1);
|
dup2(pager_process.in, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user