libcmutils 0.6.5
Multi-platform C99 utility library
Loading...
Searching...
No Matches
Child process creation and control.

Data Structures

struct  CMUTIL_Process
 structure for managing external processes. More...
 

Enumerations

enum  CMProcStreamType {
  CMProcStreamNone = 0 , CMProcStreamRead = 1 , CMProcStreamWrite = 2 , CMProcStreamReadWrite = 3 ,
  CMProcStreamReadErr = 4
}
 of process stream types. More...
 

Functions

CMUTIL_ProcessCMUTIL_ProcessCreateEx (const char *cwd, CMUTIL_Map *env, const char *command,...)
 Creates a new process with the specified command and arguments.
 

Detailed Description

Enumeration Type Documentation

◆ CMProcStreamType

of process stream types.

Enumerator
CMProcStreamNone 

Process with no stream. The stdout and stderr of the child process will be redirected to the current process's stdout and stderr

CMProcStreamRead 

Process with read stream. The current process can read from the child process's stdout using the Read method.

CMProcStreamWrite 

Process with writing stream. The current process can write to the child process's stdin using Write method

CMProcStreamReadWrite 

Process with read and write streams. The current process can read from the child process's stdout and write to the child process's stdin. This is the same as CMProcStreamRead | CMProcStreamWrite.

CMProcStreamReadErr 

Process with read the error streams. The current process can read from the child process's stderr using the ReadErr method.

Function Documentation

◆ CMUTIL_ProcessCreateEx()

CMUTIL_Process * CMUTIL_ProcessCreateEx ( const char *  cwd,
CMUTIL_Map env,
const char *  command,
  ... 
)

Creates a new process with the specified command and arguments.

Sets working directory, environment variables, command, and arguments for the new process. Same as CMUTIL_ProcessCreate macro, but the last parameter must be NULL.

Parameters
cwdThe working directory for the new process.
envThe environment variables for the new process.
commandThe command to execute in the new process.
...Additional arguments of the process. The last argument must be NULL.
Returns
A pointer to the newly created process, or NULL on failure.