Skip to content

Commit

Permalink
Merge branch 'pager/less-quirk' of https://github.com/t-8ch/util-linux
Browse files Browse the repository at this point in the history
* 'pager/less-quirk' of https://github.com/t-8ch/util-linux:
  Revert "lib/pager: Apply pager-specific fixes only when needed"
  • Loading branch information
karelzak committed Apr 15, 2024
2 parents 01fb5ec + 966cb13 commit 1dca397
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions lib/pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ static int start_command(struct child_process *cmd)
close(cmd->in);
}

if (cmd->preexec_cb)
cmd->preexec_cb();

cmd->preexec_cb();
execvp(cmd->argv[0], (char *const*) cmd->argv);
errexec(cmd->argv[0]);
}
Expand Down Expand Up @@ -142,7 +140,7 @@ static int finish_command(struct child_process *cmd)
return wait_or_whine(cmd->pid);
}

static void pager_preexec_less(void)
static void pager_preexec(void)
{
/*
* Work around bug in "less" by not starting it until we
Expand Down Expand Up @@ -243,11 +241,7 @@ static void __setup_pager(void)
pager_argv[2] = pager;
pager_process.argv = pager_argv;
pager_process.in = -1;

if (!strncmp(pager, "less", 4))
pager_process.preexec_cb = pager_preexec_less;
else
pager_process.preexec_cb = NULL;
pager_process.preexec_cb = pager_preexec;

if (start_command(&pager_process))
return;
Expand Down

0 comments on commit 1dca397

Please sign in to comment.