diff options
author | René Scharfe <l.s.r@web.de> | 2022-10-30 14:50:27 +0300 |
---|---|---|
committer | Taylor Blau <me@ttaylorr.com> | 2022-10-30 21:04:39 +0300 |
commit | 4120294cbf8e434c1de408434842d570eba0e25d (patch) | |
tree | 0def81e9ce1e3fea930a331fde52a8079368ec80 /ll-merge.c | |
parent | 242aa33de0f18bf09dd147401af9b44cf961d532 (diff) |
use child_process member "args" instead of string array variable
Use run_command() with a struct child_process variable and populate its
"args" member directly instead of building a string array and passing it
to run_command_v_opt(). This avoids the use of magic index numbers and
makes simplifies the possible addition of more arguments in the future.
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'll-merge.c')
-rw-r--r-- | ll-merge.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ll-merge.c b/ll-merge.c index 8955d7e1f6..d5f0c62bd8 100644 --- a/ll-merge.c +++ b/ll-merge.c @@ -193,7 +193,7 @@ static enum ll_merge_result ll_ext_merge(const struct ll_merge_driver *fn, struct strbuf cmd = STRBUF_INIT; struct strbuf_expand_dict_entry dict[6]; struct strbuf path_sq = STRBUF_INIT; - const char *args[] = { NULL, NULL }; + struct child_process child = CHILD_PROCESS_INIT; int status, fd, i; struct stat st; enum ll_merge_result ret; @@ -219,8 +219,9 @@ static enum ll_merge_result ll_ext_merge(const struct ll_merge_driver *fn, strbuf_expand(&cmd, fn->cmdline, strbuf_expand_dict_cb, &dict); - args[0] = cmd.buf; - status = run_command_v_opt(args, RUN_USING_SHELL); + child.use_shell = 1; + strvec_push(&child.args, cmd.buf); + status = run_command(&child); fd = open(temp[1], O_RDONLY); if (fd < 0) goto bad; |