Skip to content

Commit e8320f3

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3fe4498 commit e8320f3

File tree

3 files changed

+0
-29
lines changed

3 files changed

+0
-29
lines changed

pager.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,6 @@
1111
* something different on Windows.
1212
*/
1313

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-
2914
static const char *pager_argv[] = { NULL, NULL };
3015
static struct child_process pager_process;
3116

@@ -93,9 +78,6 @@ void setup_pager(void)
9378
static const char *env[] = { "LESS=FRSX", NULL };
9479
pager_process.env = env;
9580
}
96-
#ifndef WIN32
97-
pager_process.preexec_cb = pager_preexec;
98-
#endif
9981
if (start_command(&pager_process))
10082
return;
10183

run-command.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -394,16 +394,6 @@ int start_command(struct child_process *cmd)
394394
unsetenv(*cmd->env);
395395
}
396396
}
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-
}
407397
if (cmd->git_cmd) {
408398
execv_git_cmd(cmd->argv);
409399
} else if (cmd->use_shell) {

run-command.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ struct child_process {
3939
unsigned stdout_to_stderr:1;
4040
unsigned use_shell:1;
4141
unsigned clean_on_exit:1;
42-
void (*preexec_cb)(void);
4342
};
4443

4544
int start_command(struct child_process *);

0 commit comments

Comments
 (0)