]> git.ipfire.org Git - thirdparty/git.git/commit - pager.c
spawn pager via run_command interface
authorJeff King <peff@peff.net>
Tue, 22 Jul 2008 07:14:12 +0000 (03:14 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sat, 26 Jul 2008 04:29:44 +0000 (21:29 -0700)
commitea27a18ce2bf5860974745c04c24864231029e1d
treec7ea459090c11b608bdde357805c0fc42278af28
parentccf08bc3d06050fbe9b76846f6e2ab6d1cd6bd09
spawn pager via run_command interface

This has two important effects:

 1. The pager is now the _child_ process, instead of the
    parent. This means that whatever spawned git (e.g., the
    shell) will see the exit code of the git process, and
    not the pager.

 2. The mingw and regular code are now unified, which makes
    the setup_pager function much simpler.

There are two caveats:

 1. We used to call execlp directly on the pager, followed
    by trying to exec it via the shall. We now just use the
    shell (which is what mingw has always done). This may
    have different results for pager names which contain
    shell metacharacters.

    It is also slightly less efficient because we
    unnecessarily run the shell; however, pager spawning is
    by definition an interactive task, so it shouldn't be
    a huge problem.

 2. The git process will remain in memory while the user
    looks through the pager. This is potentially wasteful.
    We could get around this by turning the parent into a
    meta-process which spawns _both_ git and the pager,
    collects the exit status from git, waits for both to
    end, and then exits with git's exit code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pager.c