summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pager.c4
-rwxr-xr-xt/t7006-pager.sh5
2 files changed, 8 insertions, 1 deletions
diff --git a/pager.c b/pager.c
index 52f27a6765..27877f8ebb 100644
--- a/pager.c
+++ b/pager.c
@@ -8,7 +8,7 @@
#define DEFAULT_PAGER "less"
#endif
-static struct child_process pager_process = CHILD_PROCESS_INIT;
+static struct child_process pager_process;
static const char *pager_program;
/* Is the value coming back from term_columns() just a guess? */
@@ -124,6 +124,8 @@ void setup_pager(void)
setenv("GIT_PAGER_IN_USE", "true", 1);
+ child_process_init(&pager_process);
+
/* spawn the pager */
prepare_pager_args(&pager_process, pager);
pager_process.in = -1;
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index 0e7cf75435..eed680a2b1 100755
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
@@ -786,4 +786,9 @@ test_expect_success TTY 'git returns SIGPIPE on propagated signals from pager' '
test_path_is_file pager-used
'
+test_expect_success TTY 'non-existent pager doesnt cause crash' '
+ test_config pager.show invalid-pager &&
+ test_terminal git show
+'
+
test_done