pager: drop "wait for output to run less" hack
Commit 35ce862 (pager: Work around window resizing bug in 'less', 2007-01-24) causes git's pager sub-process to wait to receive input after forking but before exec-ing the pager. To handle this, run-command had to grow a "pre-exec callback" feature. Unfortunately, this feature does not work at all on Windows (where we do not fork), and interacts poorly with run-command's parent notification system. Its use should be discouraged. The bug in less was fixed in version 406, which was released in June 2007. It is probably safe at this point to remove our workaround. That lets us rip out the preexec_cb feature entirely. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Jun 5, 2012 at 04:56 UTC
e8320f350f523c3219ff8ec639663193941af57d
3 files changed
-29
pager.c
-18
@@ -11,21 +11,6 @@
11
* something different on Windows.
12
*/
13
14
-#ifndef WIN32
15
-static void pager_preexec(void)
16
-{
17
- /*
18
- * Work around bug in "less" by not starting it until we
19
- * have real input
20
- */
21
- fd_set in;
22
-
23
- FD_ZERO(&in);
24
- FD_SET(0, &in);
25
- select(1, &in, NULL, &in, NULL);
26
-}
27
-#endif
28
-
14
static const char *pager_argv[] = { NULL, NULL };
15
static struct child_process pager_process;
16
@@ -93,9 +78,6 @@ void setup_pager(void)
78
static const char *env[] = { "LESS=FRSX", NULL };
79
pager_process.env = env;
80
}
96
-#ifndef WIN32
97
- pager_process.preexec_cb = pager_preexec;
98
-#endif
81
if (start_command(&pager_process))
82
return;
83
run-command.c
-10
@@ -394,16 +394,6 @@ fail_pipe:
394
unsetenv(*cmd->env);
395
}
396
}
397
- if (cmd->preexec_cb) {
398
- /*
399
- * We cannot predict what the pre-exec callback does.
400
- * Forgo parent notification.
401
- */
402
- close(child_notifier);
403
- child_notifier = -1;
404
-
405
- cmd->preexec_cb();
406
- }
397
if (cmd->git_cmd) {
398
execv_git_cmd(cmd->argv);
399
} else if (cmd->use_shell) {
run-command.h
-1
@@ -39,7 +39,6 @@ struct child_process {
39
unsigned stdout_to_stderr:1;
40
unsigned use_shell:1;
41
unsigned clean_on_exit:1;
42
- void (*preexec_cb)(void);
42
};
43
44
int start_command(struct child_process *);