Skip to content

Commit d82dbbd

Browse files
rscharfettaylorr
authored andcommitted
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 <[email protected]> Signed-off-by: Taylor Blau <[email protected]>
1 parent eb5b6b5 commit d82dbbd

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

fsmonitor-ipc.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,14 @@ enum ipc_active_state fsmonitor_ipc__get_state(void)
5454

5555
static int spawn_daemon(void)
5656
{
57-
const char *args[] = { "fsmonitor--daemon", "start", NULL };
57+
struct child_process cmd = CHILD_PROCESS_INIT;
5858

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);
6165
}
6266

6367
int fsmonitor_ipc__send_query(const char *since_token,

run-command.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,11 +1009,6 @@ int run_command_v_opt(const char **argv, int opt)
10091009
return run_command_v_opt_cd_env_tr2(argv, opt, NULL, NULL, NULL);
10101010
}
10111011

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-
10171012
int run_command_v_opt_cd_env_tr2(const char **argv, int opt, const char *dir,
10181013
const char *const *env, const char *tr2_class)
10191014
{

run-command.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ int run_auto_maintenance(int quiet);
244244
* corresponds to the member .env.
245245
*/
246246
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);
248247
/*
249248
* env (the environment) is to be formatted like environ: "VAR=VALUE".
250249
* To unset an environment variable use just "VAR".

0 commit comments

Comments
 (0)