replace and remove run_command_v_opt_tr2()

The convenience function run_command_v_opt_tr2() is only used by a single caller. Use struct child_process and run_command() directly instead and remove the underused function. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Taylor Blau <me@ttaylorr.com>

René Scharfe committed Oct 30, 2022 at 12:52 UTC d82dbbd849fadd9d61d9489a03b429b6d1413c81
3 files changed +7 -9
fsmonitor-ipc.c
+7 -3
@@ -54,10 +54,14 @@ enum ipc_active_state fsmonitor_ipc__get_state(void)
54
55 static int spawn_daemon(void)
56 {
57 - const char *args[] = { "fsmonitor--daemon", "start", NULL };
57 + struct child_process cmd = CHILD_PROCESS_INIT;
58
59 - return run_command_v_opt_tr2(args, RUN_COMMAND_NO_STDIN | RUN_GIT_CMD,
60 - "fsmonitor");
59 + cmd.git_cmd = 1;
60 + cmd.no_stdin = 1;
61 + cmd.trace2_child_class = "fsmonitor";
62 + strvec_pushl(&cmd.args, "fsmonitor--daemon", "start", NULL);
63 +
64 + return run_command(&cmd);
65 }
66
67 int fsmonitor_ipc__send_query(const char *since_token,
run-command.c
-5
@@ -1009,11 +1009,6 @@ int run_command_v_opt(const char **argv, int opt)
1009 return run_command_v_opt_cd_env_tr2(argv, opt, NULL, NULL, NULL);
1010 }
1011
1012 -int run_command_v_opt_tr2(const char **argv, int opt, const char *tr2_class)
1013 -{
1014 - return run_command_v_opt_cd_env_tr2(argv, opt, NULL, NULL, tr2_class);
1015 -}
1016 -
1012 int run_command_v_opt_cd_env_tr2(const char **argv, int opt, const char *dir,
1013 const char *const *env, const char *tr2_class)
1014 {
run-command.h
-1
@@ -244,7 +244,6 @@ int run_auto_maintenance(int quiet);
244 * corresponds to the member .env.
245 */
246 int run_command_v_opt(const char **argv, int opt);
247 -int run_command_v_opt_tr2(const char **argv, int opt, const char *tr2_class);
247 /*
248 * env (the environment) is to be formatted like environ: "VAR=VALUE".
249 * To unset an environment variable use just "VAR".