2 #include "spawn-pipe.h"
5 * This is split up from the rest of git so that we might do
6 * something different on Windows, for example.
10 static void run_pager(const char *pager
)
12 execlp(pager
, pager
, NULL
);
13 execl("/bin/sh", "sh", "-c", pager
, NULL
);
17 void setup_pager(void)
22 const char *pager_argv
[] = { "sh", "-c", NULL
, NULL
};
25 const char *pager
= getenv("GIT_PAGER");
30 pager
= getenv("PAGER");
33 else if (!*pager
|| !strcmp(pager
, "cat"))
36 pager_in_use
= 1; /* means we are emitting to terminal */
48 /* return in the child */
56 /* The original process turns into the PAGER */
61 setenv("LESS", "FRSX", 0);
63 die("unable to execute pager '%s'", pager
);
67 pager_argv
[2] = pager
;
68 if (spawnvpe_pipe(pager_argv
[0], pager_argv
, environ
, fd
, NULL
) < 0)
71 /* original process continues, but writes to the pipe */