Should be run for normal termination (not in SIGTERM/SIGINT handler) of our program. @return 0 on success and -1 on error (also sets errno).
Initialize the library. Call it before libcomcom_run_command(). Note that this erases the old SIGCHLD handler (if any). @return 0 on success and -1 on error (also sets errno).
Initialize the library. Call it before libcomcom_run_command(). The old signal action is stored internally (and restored by libcomcom_destroy() or libcomcom_terminate()). The old signal handler (the one obtained from old variable) is also called from our SIGCHLD handler. @return 0 on success and -1 on error (also sets errno).
Initialize the library. Call it before libcomcom_run_command(). This function is like libcomcom_init2(), but the old SIGCHLD signal handler is obtained automatically (by sigaction() library function).
Uninstall SIGTERM and SIGINT handler which calls libcomcom_terminate(). @return 0 on success and -1 on error (also sets errno).
Resets to signal handlers which were before calling libcomcom_set_default_terminate2(). @return 0 on success and -1 on error (also sets errno).
Runs an OS command. @param input passed to command stdin @param input_len the length of the string passed to stdin @param output at this location is stored the command's stdout (call free() after use) @param output_len at this location is stored the length of command's stdout @param file the command to run (PATH used) @param argv arguments for the command to run @param envp environment for the command to run (pass NULL to duplicate our environment) @param timeout timeout in milliseconds, -1 means infinite timeout @return 0 on success and -1 on error (also sets errno).
Install SIGTERM and SIGINT handler which calls libcomcom_terminate(). @return 0 on success and -1 on error (also sets errno).
Install SIGTERM and SIGINT handler which calls libcomcom_terminate(). @return 0 on success and -1 on error (also sets errno).
Usually should be run in SIGTERM and SIGINT handlers. @return 0 on success and -1 on error (also sets errno).