summaryrefslogtreecommitdiff
path: root/run-command.h
diff options
context:
space:
mode:
Diffstat (limited to 'run-command.h')
-rw-r--r--run-command.h71
1 files changed, 25 insertions, 46 deletions
diff --git a/run-command.h b/run-command.h
index 4987826258..07bed6c31b 100644
--- a/run-command.h
+++ b/run-command.h
@@ -44,22 +44,35 @@
struct child_process {
/**
- * The .argv member is set up as an array of string pointers (NULL
- * terminated), of which .argv[0] is the program name to run (usually
- * without a path). If the command to run is a git command, set argv[0] to
- * the command name without the 'git-' prefix and set .git_cmd = 1.
+ * The .args is a `struct strvec', use that API to manipulate
+ * it, e.g. strvec_pushv() to add an existing "const char **"
+ * vector.
*
- * Note that the ownership of the memory pointed to by .argv stays with the
- * caller, but it should survive until `finish_command` completes. If the
- * .argv member is NULL, `start_command` will point it at the .args
- * `strvec` (so you may use one or the other, but you must use exactly
- * one). The memory in .args will be cleaned up automatically during
- * `finish_command` (or during `start_command` when it is unsuccessful).
+ * If the command to run is a git command, set the first
+ * element in the strvec to the command name without the
+ * 'git-' prefix and set .git_cmd = 1.
*
+ * The memory in .args will be cleaned up automatically during
+ * `finish_command` (or during `start_command` when it is unsuccessful).
*/
- const char **argv;
-
struct strvec args;
+
+ /**
+ * Like .args the .env_array is a `struct strvec'.
+ *
+ * To modify the environment of the sub-process, specify an array of
+ * environment settings. Each string in the array manipulates the
+ * environment.
+ *
+ * - If the string is of the form "VAR=value", i.e. it contains '='
+ * the variable is added to the child process's environment.
+ *
+ * - If the string does not contain '=', it names an environment
+ * variable that will be removed from the child process's environment.
+ *
+ * The memory in .env_array will be cleaned up automatically during
+ * `finish_command` (or during `start_command` when it is unsuccessful).
+ */
struct strvec env_array;
pid_t pid;
@@ -96,23 +109,6 @@ struct child_process {
*/
const char *dir;
- /**
- * To modify the environment of the sub-process, specify an array of
- * string pointers (NULL terminated) in .env:
- *
- * - If the string is of the form "VAR=value", i.e. it contains '='
- * the variable is added to the child process's environment.
- *
- * - If the string does not contain '=', it names an environment
- * variable that will be removed from the child process's environment.
- *
- * If the .env member is NULL, `start_command` will point it at the
- * .env_array `strvec` (so you may use one or the other, but not both).
- * The memory in .env_array will be cleaned up automatically during
- * `finish_command` (or during `start_command` when it is unsuccessful).
- */
- const char *const *env;
-
unsigned no_stdin:1;
unsigned no_stdout:1;
unsigned no_stderr:1;
@@ -224,23 +220,6 @@ int finish_command_in_signal(struct child_process *);
*/
int run_command(struct child_process *);
-/**
- * Run a hook.
- * The first argument is a pathname to an index file, or NULL
- * if the hook uses the default index file or no index is needed.
- * The second argument is the name of the hook.
- * The further arguments correspond to the hook arguments.
- * The last argument has to be NULL to terminate the arguments list.
- * If the hook does not exist or is not executable, the return
- * value will be zero.
- * If it is executable, the hook will be executed and the exit
- * status of the hook is returned.
- * On execution, .stdout_to_stderr and .no_stdin will be set.
- */
-LAST_ARG_MUST_BE_NULL
-int run_hook_le(const char *const *env, const char *name, ...);
-int run_hook_ve(const char *const *env, const char *name, va_list args);
-
/*
* Trigger an auto-gc
*/