Re: [PATCH 10/16] add NO_EXTERNAL_GREP build option
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Mar 13, 2008, 13:59 UTC
- Message-ID
- <47D9332C.4020904@viscovery.net>
- In-Reply-To
- <20080313124103.GC19485@coredump.intra.peff.net>
Jeff King schrieb:
> Junio's fixups should restore the automagic behavior, so you shouldn't > see any problems now, I think. But the run_command cleanup is sensible.
Thanks. But it turns out that things are not /that/ trivial. We better live with Junio's fixup.
Show 13 quoted lines
> - while (waitpid(pid, &status, 0) < 0) {
> - if (errno == EINTR)
> - continue;
> - return -1;
> - }
> - if (WIFEXITED(status)) {
> - if (!WEXITSTATUS(status))
> - return 1;
> - return 0;
> - }
> - return -1;
> -}
> -...
> + status = run_command_v_opt(argv, 0);
...
> + return status == 0 ? 1 : -1;
grep can return 0 (success, something found), 1 (nothing found), and other values for "real" failures like usage errors or crashes. This conditional throws the latter two into the same pot, which makes git-grep unable to distinguish "nothing found" from failure; cf. the call sites of flush_grep(), where want to set the flag 'hit'.
-- Hannes