• Colin Watson's avatar
    Add pipecmd_pre_exec function · be7edd06
    Colin Watson authored
    * lib/pipeline-private.h (struct pipecmd): Add pre_exec_func,
    pre_exec_free_func, and pre_exec_data.
    * lib/pipeline.c (pipecmd_new, pipecmd_new_function,
    pipecmd_new_sequencev): Initialise cmd->pre_exec_func,
    cmd->pre_exec_free_func, and cmd->pre_exec_data.
    (pipecmd_dup): Copy cmd->pre_exec_func, cmd->pre_exec_free_func, and
    cmd->pre_exec_data if necessary.
    (pipecmd_pre_exec): New function.
    (pipecmd_exec): If cmd->pre_exec_func is set, call it immediately before
    calling execvp or cmd->func.
    * lib/pipeline.h (pipecmd_pre_exec): Add prototype.
    (pipeline_install_post_fork): Cross-reference pipecmd_pre_exec in
    * man/Makefile.am (FUNCTIONS): Add pipecmd_pre_exec.
    * man/libpipeline.3 (Functions to build individual commands): Document
    (Functions to run pipelines and handle signals): Cross-reference
    pipecmd_pre_exec from pipeline_install_post_fork.
    * tests/basic.c (test_basic_pre_exec): Test pipecmd_pre_exec.
    * NEWS: Document this.
    * README: Update copyright years.