#include <boost/process/detail/posix/handler.hpp>
#include <unistd.h>
+#include <boost/process/detail/used_handles.hpp>
+#include <array>
namespace boost { namespace process { namespace detail { namespace posix {
-struct close_fd_ : handler_base_ext
+struct close_fd_ : handler_base_ext, ::boost::process::detail::uses_handles
{
close_fd_(int fd) : fd_(fd) {}
e.set_error(::boost::process::detail::get_last_error(), "close() failed");
}
+ int get_used_handles() {return fd_;}
+
+
private:
int fd_;
};
template <class Range>
-struct close_fds_ : handler_base_ext
+struct close_fds_ : handler_base_ext, ::boost::process::detail::uses_handles
{
public:
close_fds_(const Range &fds) : fds_(fds) {}
}
}
+ Range& get_used_handles() {return fds_;}
+
private:
Range fds_;
};
template <class FileDescriptor>
-struct bind_fd_ : handler_base_ext
+struct bind_fd_ : handler_base_ext, ::boost::process::detail::uses_handles
{
public:
bind_fd_(int id, const FileDescriptor &fd) : id_(id), fd_(fd) {}
e.set_error(::boost::process::detail::get_last_error(), "dup2() failed");
}
+ std::array<int, 2> get_used_handles() {return {id_, fd_};}
+
+
private:
int id_;
FileDescriptor fd_;