diff options
author | René Scharfe <l.s.r@web.de> | 2022-10-30 11:51:14 (GMT) |
---|---|---|
committer | Taylor Blau <me@ttaylorr.com> | 2022-10-30 18:04:40 (GMT) |
commit | 0e90673957f12adc1a84b13d3dfff02151e4a7a8 (patch) | |
tree | 737050f737be02089d750d4a291cc65421afc89b /builtin/gc.c | |
parent | 4120294cbf8e434c1de408434842d570eba0e25d (diff) | |
download | git-0e90673957f12adc1a84b13d3dfff02151e4a7a8.zip git-0e90673957f12adc1a84b13d3dfff02151e4a7a8.tar.gz git-0e90673957f12adc1a84b13d3dfff02151e4a7a8.tar.bz2 |
use child_process members "args" and "env" directly
Build argument list and environment of child processes by using
struct child_process and populating its members "args" and "env"
directly instead of maintaining separate strvecs and letting
run_command_v_opt() and friends populate these members. This is
simpler, shorter and slightly more efficient.
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'builtin/gc.c')
-rw-r--r-- | builtin/gc.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/builtin/gc.c b/builtin/gc.c index 243ee85..87ad007 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -1910,20 +1910,16 @@ static char *schtasks_task_name(const char *frequency) static int schtasks_remove_task(enum schedule_priority schedule) { const char *cmd = "schtasks"; - int result; - struct strvec args = STRVEC_INIT; + struct child_process child = CHILD_PROCESS_INIT; const char *frequency = get_frequency(schedule); char *name = schtasks_task_name(frequency); get_schedule_cmd(&cmd, NULL); - strvec_split(&args, cmd); - strvec_pushl(&args, "/delete", "/tn", name, "/f", NULL); - - result = run_command_v_opt(args.v, 0); - - strvec_clear(&args); + strvec_split(&child.args, cmd); + strvec_pushl(&child.args, "/delete", "/tn", name, "/f", NULL); free(name); - return result; + + return run_command(&child); } static int schtasks_remove_tasks(void) |