Pharos 0.7.23
Modern Web Framework & Web App Hosting Service.
Loading...
Searching...
No Matches
native_process_capture.h File Reference

Declares child-process capture helpers. More...

#include <stddef.h>

Go to the source code of this file.

Functions

Process capture helpers
int capture_execv_output_native (char *const argv[], char **output, size_t *output_len)
 Executes a process and captures its combined output.
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_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 run_process_capture_native (char *const argv[], char **output)
 Executes a process and captures its combined output text.

Detailed Description

Declares child-process capture helpers.

Definition in file native_process_capture.h.

Function Documentation

◆ capture_execv_output_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.

Parameters
argvNull-terminated argv array for the child process.
env_keysEnvironment variable names to set.
env_valuesEnvironment variable values paired with env_keys.
env_countNumber of environment pairs to apply.
outputDestination for the allocated output buffer.
output_lenOptional destination for the output length.
Returns
Process exit status, or a non-zero launcher status on failure.

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().

◆ capture_execv_output_native()

int capture_execv_output_native ( char *const argv[],
char ** output,
size_t * output_len )

Executes a process and captures its combined output.

Parameters
argvNull-terminated argv array for the child process.
outputDestination for the allocated output buffer.
output_lenOptional destination for the output length.
Returns
Process exit status, or a non-zero launcher status on failure.

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().

◆ capture_execv_output_split_env_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.

Parameters
argvNull-terminated argv array for the child process.
env_keysEnvironment variable names to set.
env_valuesEnvironment variable values paired with env_keys.
env_countNumber of environment pairs to apply.
stdout_outputDestination for the allocated stdout buffer.
stdout_lenOptional destination for the stdout length.
stderr_outputDestination for the allocated stderr buffer.
stderr_lenOptional destination for the stderr length.
Returns
Process exit status, or a non-zero launcher status on failure.

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().

◆ run_process_capture_native()

int run_process_capture_native ( char *const argv[],
char ** output )

Executes a process and captures its combined output text.

Parameters
argvNull-terminated argv array for the child process.
outputDestination for the allocated output buffer.
Returns
Process exit status, or a non-zero launcher status on failure.

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().