Skip to content
  • Jeff King's avatar
    git: use run_command() to execute dashed externals · d8e96fd8
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    We used to simply try calling execvp(); if it succeeded, then we were done
    and the new program was running. If it didn't, then we knew that it wasn't
    a valid command.
    
    Unfortunately, this interacted badly with the new pager handling. Now that
    git remains the parent process and the pager is spawned, git has to hang
    around until the pager is finished. We install an atexit handler to do
    this, but that handler never gets called if we successfully run execvp.
    
    You could see this behavior by running any dashed external using a pager
    (e.g., "git -p stash list"). The command finishes running, but the pager
    is still going. In the case of less, it then gets an error reading from
    the terminal and exits, potentially leaving the terminal in a broken state
    (and not showing the output).
    
    This patch just uses run_command() to try running the dashed external. The
    parent git process then waits for the external process to complete and
    then handles the pager cleanup as it would for an internal command.
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    d8e96fd8