|
Pharos 0.7.23
Modern Web Framework & Web App Hosting Service.
|
Runs child processes and captures their output, optionally with injected environment values. More...
#include "native_process_capture.h"#include "native_support.h"#include <poll.h>#include <spawn.h>#include <stdlib.h>#include <string.h>#include <sys/wait.h>#include <unistd.h>Go to the source code of this file.
Functions | |
| static int | append_pipe_to_buffer (int fd, Buffer *buffer, int *open_flag) |
| static char * | build_child_env_assignment_native (const char *key, const char *value) |
| static void | free_child_env_native (char **child_env, size_t base_count, size_t child_count) |
| static char ** | build_child_env_native (const char *env_keys[], const char *env_values[], size_t env_count, size_t *base_count_out, size_t *child_count_out) |
| int | capture_execv_output_split_env_native (char *const argv[], const char *env_keys[], const char *env_values[], size_t env_count, char **stdout_output, size_t *stdout_len, char **stderr_output, size_t *stderr_len) |
| Executes a process with injected environment values and captures stdout and stderr separately. | |
| int | capture_execv_output_env_native (char *const argv[], const char *env_keys[], const char *env_values[], size_t env_count, char **output, size_t *output_len) |
| Executes a process with injected environment values and captures its output. | |
| int | capture_execv_output_native (char *const argv[], char **output, size_t *output_len) |
| Executes a process and captures its combined output. | |
| int | run_process_capture_native (char *const argv[], char **output) |
| Executes a process and captures its combined output text. | |
Variables | |
| char ** | environ |
Runs child processes and captures their output, optionally with injected environment values.
Definition in file native_process_capture.c.
|
static |
Definition at line 22 of file native_process_capture.c.
References buffer_append().
Referenced by capture_execv_output_split_env_native().
|
static |
Definition at line 39 of file native_process_capture.c.
Referenced by build_child_env_native().
|
static |
Definition at line 69 of file native_process_capture.c.
References build_child_env_assignment_native(), and environ.
Referenced by capture_execv_output_split_env_native().
| int capture_execv_output_env_native | ( | char *const | argv[], |
| const char * | env_keys[], | ||
| const char * | env_values[], | ||
| size_t | env_count, | ||
| char ** | output, | ||
| size_t * | output_len ) |
Executes a process with injected environment values and captures its output.
| argv | Null-terminated argv array for the child process. |
| env_keys | Environment variable names to set. |
| env_values | Environment variable values paired with env_keys. |
| env_count | Number of environment pairs to apply. |
| output | Destination for the allocated output buffer. |
| output_len | Optional destination for the output length. |
Definition at line 277 of file native_process_capture.c.
References buffer_append(), buffer_free(), buffer_init(), capture_execv_output_split_env_native(), Buffer::data, and Buffer::len.
Referenced by capture_execv_output_native(), maybe_seed_app_state_native(), and shell_runtime_command_capture_native().
| int capture_execv_output_native | ( | char *const | argv[], |
| char ** | output, | ||
| size_t * | output_len ) |
Executes a process and captures its combined output.
| argv | Null-terminated argv array for the child process. |
| output | Destination for the allocated output buffer. |
| output_len | Optional destination for the output length. |
Definition at line 313 of file native_process_capture.c.
References capture_execv_output_env_native().
Referenced by build_dev_docs_directory_native(), capture_checksum_output_runtime(), and run_process_capture_native().
| int capture_execv_output_split_env_native | ( | char *const | argv[], |
| const char * | env_keys[], | ||
| const char * | env_values[], | ||
| size_t | env_count, | ||
| char ** | stdout_output, | ||
| size_t * | stdout_len, | ||
| char ** | stderr_output, | ||
| size_t * | stderr_len ) |
Executes a process with injected environment values and captures stdout and stderr separately.
| argv | Null-terminated argv array for the child process. |
| env_keys | Environment variable names to set. |
| env_values | Environment variable values paired with env_keys. |
| env_count | Number of environment pairs to apply. |
| stdout_output | Destination for the allocated stdout buffer. |
| stdout_len | Optional destination for the stdout length. |
| stderr_output | Destination for the allocated stderr buffer. |
| stderr_len | Optional destination for the stderr length. |
Definition at line 121 of file native_process_capture.c.
References append_pipe_to_buffer(), buffer_free(), buffer_init(), build_child_env_native(), Buffer::data, environ, free_child_env_native(), and Buffer::len.
Referenced by capture_execv_output_env_native(), and spawn_app_request().
|
static |
Definition at line 58 of file native_process_capture.c.
Referenced by capture_execv_output_split_env_native().
| int run_process_capture_native | ( | char *const | argv[], |
| char ** | output ) |
Executes a process and captures its combined output text.
| argv | Null-terminated argv array for the child process. |
| output | Destination for the allocated output buffer. |
Definition at line 317 of file native_process_capture.c.
References capture_execv_output_native().
Referenced by handle_native_deploy_package_deb_command(), native_capture_trimmed(), and native_capture_trimmed().
|
extern |
Referenced by build_child_env_native(), and capture_execv_output_split_env_native().