Skip to content

Commit d83c9c7

Browse files
committed
Merge branch 'jk/grep-tell-run-command-to-cd-when-running-pager'
* jk/grep-tell-run-command-to-cd-when-running-pager: grep: use run-command's "dir" option for --open-files-in-pager
2 parents 09e141f + 26ecfe3 commit d83c9c7

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

builtin/grep.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,7 @@ static void run_pager(struct grep_opt *opt, const char *prefix)
361361
argv[i] = path_list->items[i].string;
362362
argv[path_list->nr] = NULL;
363363

364-
if (prefix && chdir(prefix))
365-
die(_("Failed to chdir: %s"), prefix);
366-
status = run_command_v_opt(argv, RUN_USING_SHELL);
364+
status = run_command_v_opt_cd_env(argv, RUN_USING_SHELL, prefix, NULL);
367365
if (status)
368366
exit(status);
369367
free(argv);

0 commit comments

Comments
 (0)