Interface to the code that starts programs (launcher module)
More...
Go to the source code of this file.
|
void | jpl_init (jpl_on_child_exit on_child_exit, jpl_log_callback log_callback) |
| initialize the launcher module
|
|
bool | jpl_execute (void *ctx, const char *working_dir, bool run_in_terminal, const char *commandline, const char *const *env_vars, const char *const *ldpreload, pid_t *pid_ptr, jpl_child_handle *child_handle_ptr) |
| run child program in a subprocess
|
|
void | jpl_run (void) |
| Read subprocess output and call the callbacks.
|
|
void | jpl_uninit (void) |
| uninitialize the launcher module
|
|
unsigned int | jpl_get_app_count (void) |
| get number of child processes
|
|
Interface to the code that starts programs (launcher module)
◆ jpl_child_handle
Handle to object describing child
◆ jpl_log_callback
typedef void(* jpl_log_callback) (void *ctx, bool error, const char *format,...) |
function type for callback called on child exit
- Parameters
-
ctx | context pointer with value as supplied by call to jpl_execute() |
error | whether line from stderr (true) is being logged or from stdout (false) |
format | format string |
... | optional args, as specified by format parameter |
◆ jpl_on_child_exit
typedef void(* jpl_on_child_exit) (void *ctx, int exit_status) |
function type for callback called on child exit
- Parameters
-
ctx | context pointer with value as supplied by call to jpl_execute() |
exit_status | Exit status of the child process |
◆ jpl_execute()
bool jpl_execute |
( |
void * |
ctx, |
|
|
const char * |
working_dir, |
|
|
bool |
run_in_terminal, |
|
|
const char * |
commandline, |
|
|
const char *const * |
env_vars, |
|
|
const char *const * |
ldpreload, |
|
|
pid_t * |
pid_ptr, |
|
|
jpl_child_handle * |
child_handle_ptr |
|
) |
| |
run child program in a subprocess
- Parameters
-
ctx | context pointer that will be passed as parameter when functions, previously specified int the jpl_init() call, are called. |
working_dir | working dir where the program is started |
run_in_terminal | whether to run the child program in a new terminal |
commandline | command-line to use for starting the child process |
env_vars | optional (can be NULL) array of strings for environment variables to be set in the child process the array is terminated by empty string element. |
ldpreload | optional (can be NULL) array of strings for LD_PRELOAD-ed libraries. the array is terminated by empty string element. |
pid_ptr | pointer to variable where, upon successful return, the child process identifier value will be stored. |
child_handle_ptr | pointer to variable where, upon successful return, child handle is stored. |
- Returns
- success status
◆ jpl_init()
initialize the launcher module
- Parameters
-
on_child_exit | function to call back when child exits |
log_callback | function to call back child produces a line |