Internal API Reference - Spawn Utilities
Desktop Apps Training - Policy Kit

Synopsis



enum KitSpawnFlags;
kit_bool_t kit_spawn_sync (const char *working_directory,
KitSpawnFlags flags,
char **argv,
char **envp,
char *stdin,
char **stdout,
char **stderr,
int *out_exit_status);

Description

Various spawn utilities.

 

Details

enum KitSpawnFlags

typedef enum {
KIT_SPAWN_CHILD_INHERITS_STDIN = 1 << 0,
KIT_SPAWN_STDOUT_TO_DEV_NULL = 1 << 1,
KIT_SPAWN_STDERR_TO_DEV_NULL = 1 << 2,
} KitSpawnFlags;

Flags passed to kit_spawn_sync().

 

KIT_SPAWN_CHILD_INHERITS_STDIN

If not set, child's stdin will be attached to /dev/null

KIT_SPAWN_STDOUT_TO_DEV_NULL

If set childs output will be sent to /dev/null

KIT_SPAWN_STDERR_TO_DEV_NULL

If set childs error output will be sent to /dev/null

kit_spawn_sync ()

kit_bool_t          kit_spawn_sync                      (const char *working_directory,
KitSpawnFlags flags,
char **argv,
char **envp,
char *stdin,
char **stdout,
char **stderr,
int *out_exit_status);

Executes a child process and waits for the child process to exit before returning. The exit status of the child is stored in out_exit_status as it would be returned by waitpid(); standard UNIX macros such as WIFEXITED() and WEXITSTATUS() must be used to evaluate the exit status.

 

working_directory :

Working directory for child or NULL to inherit parents

flags :

A combination of flags from KitSpawnFlags

argv :

NULL terminated argument vector

envp :

NULL terminated environment or NULL to inherit parents;

stdin :

String to write to stdin of child or NULL

stdout :

Return location for stdout from child or NULL. Free with kit_free().

stderr :

Return location for stderr from child or NULL. Free with kit_free().

out_exit_status :

Return location for exit status

Returns :

TRUE if the child was executed; FALSE if an error occured and errno will be set.