diff options
author | René Scharfe <l.s.r@web.de> | 2022-10-30 12:50:27 +0100 |
---|---|---|
committer | Taylor Blau <me@ttaylorr.com> | 2022-10-30 19:04:39 +0100 |
commit | 4120294cbf8e434c1de408434842d570eba0e25d (patch) | |
tree | 0def81e9ce1e3fea930a331fde52a8079368ec80 /t/helper | |
parent | sequencer: simplify building argument list in do_exec() (diff) | |
download | git-4120294cbf8e434c1de408434842d570eba0e25d.tar.xz git-4120294cbf8e434c1de408434842d570eba0e25d.zip |
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 '')
-rw-r--r-- | t/helper/test-fake-ssh.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/t/helper/test-fake-ssh.c b/t/helper/test-fake-ssh.c index 12beee99ad..2e576bcc11 100644 --- a/t/helper/test-fake-ssh.c +++ b/t/helper/test-fake-ssh.c @@ -8,7 +8,7 @@ int cmd_main(int argc, const char **argv) struct strbuf buf = STRBUF_INIT; FILE *f; int i; - const char *child_argv[] = { NULL, NULL }; + struct child_process cmd = CHILD_PROCESS_INIT; /* First, print all parameters into $TRASH_DIRECTORY/ssh-output */ if (!trash_directory) @@ -25,6 +25,7 @@ int cmd_main(int argc, const char **argv) /* Now, evaluate the *last* parameter */ if (argc < 2) return 0; - child_argv[0] = argv[argc - 1]; - return run_command_v_opt(child_argv, RUN_USING_SHELL); + cmd.use_shell = 1; + strvec_push(&cmd.args, argv[argc - 1]); + return run_command(&cmd); } |