File indexing completed on 2025-01-18 09:50:06
0001
0002
0003
0004
0005
0006 #ifndef BOOST_PROCESS_DETAIL_POSIX_GROUP_REF_HPP_
0007 #define BOOST_PROCESS_DETAIL_POSIX_GROUP_REF_HPP_
0008
0009 #include <boost/process/detail/config.hpp>
0010 #include <boost/process/detail/posix/group_handle.hpp>
0011 #include <boost/process/detail/posix/handler.hpp>
0012 #include <unistd.h>
0013
0014
0015 namespace boost { namespace process {
0016
0017 namespace detail { namespace posix {
0018
0019
0020
0021 struct group_ref : handler_base_ext
0022 {
0023 group_handle & grp;
0024
0025
0026 explicit group_ref(group_handle & g) :
0027 grp(g)
0028 {}
0029
0030 template <class Executor>
0031 void on_exec_setup(Executor&) const
0032 {
0033 if (grp.grp == -1)
0034 ::setpgid(0, 0);
0035 else
0036 ::setpgid(0, grp.grp);
0037 }
0038
0039 template <class Executor>
0040 void on_success(Executor& exec) const
0041 {
0042 if (grp.grp == -1)
0043 grp.grp = exec.pid;
0044
0045 }
0046
0047 };
0048
0049 }}}}
0050
0051
0052 #endif