mirror of
https://github.com/boostorg/process.git
synced 2026-01-30 08:02:37 +00:00
added extensions
This commit is contained in:
@@ -66,9 +66,6 @@ private:
|
||||
|
||||
}
|
||||
|
||||
constexpr boost::process::detail::make_handler_t<boost::process::detail::on_setup_> on_setup;
|
||||
constexpr boost::process::detail::make_handler_t<boost::process::detail::on_error_> on_error;
|
||||
constexpr boost::process::detail::make_handler_t<boost::process::detail::on_success_> on_success;
|
||||
|
||||
|
||||
}}
|
||||
|
||||
@@ -48,6 +48,9 @@ template<> struct initializer_tag<std::vector<wchar_t *>> { typedef cmd_or_exe_t
|
||||
template<> struct initializer_tag<std::initializer_list<char *>> { typedef cmd_or_exe_tag<char> type;};
|
||||
template<> struct initializer_tag<std::initializer_list<wchar_t *>> { typedef cmd_or_exe_tag<wchar_t> type;};
|
||||
|
||||
template<> struct initializer_tag<std::initializer_list<const char *>> { typedef cmd_or_exe_tag<char> type;};
|
||||
template<> struct initializer_tag<std::initializer_list<const wchar_t *>> { typedef cmd_or_exe_tag<wchar_t> type;};
|
||||
|
||||
template<> struct initializer_tag<shell_>
|
||||
{
|
||||
typedef cmd_or_exe_tag<typename boost::filesystem::path::value_type> type;
|
||||
|
||||
@@ -25,8 +25,8 @@ struct env_init : public ::boost::process::detail::handler_base
|
||||
env_init(boost::process::basic_environment<Char> && env) : env(std::move(env)) {};
|
||||
env_init(const boost::process::basic_environment<Char> & env) : env(env) {};
|
||||
|
||||
::boost::detail::winapi::DWORD_ creation_flag(char) {return 0u;}
|
||||
::boost::detail::winapi::DWORD_ creation_flag(wchar_t)
|
||||
constexpr static ::boost::detail::winapi::DWORD_ creation_flag(char) {return 0u;}
|
||||
constexpr static ::boost::detail::winapi::DWORD_ creation_flag(wchar_t)
|
||||
{
|
||||
return ::boost::detail::winapi::CREATE_UNICODE_ENVIRONMENT_;
|
||||
}
|
||||
@@ -42,7 +42,7 @@ struct env_init : public ::boost::process::detail::handler_base
|
||||
}
|
||||
|
||||
exec.env = e;
|
||||
exec.creation_flags |= creation_flags(Char());
|
||||
exec.creation_flags |= creation_flag(Char());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -80,6 +80,12 @@ struct startup_info_impl
|
||||
nullptr
|
||||
};
|
||||
startup_info_t & startup_info = startup_info_ex.StartupInfo;
|
||||
|
||||
void set_startup_info_ex()
|
||||
{
|
||||
startup_info.cb = sizeof(startup_info_ex_t);
|
||||
creation_flags = ::boost::detail::winapi::EXTENDED_STARTUPINFO_PRESENT_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
70
include/boost/process/extend.hpp
Normal file
70
include/boost/process/extend.hpp
Normal file
@@ -0,0 +1,70 @@
|
||||
// Copyright (c) 2016 Klemens D. Morgenstern
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROCESS_EXTENSIONS_HPP_
|
||||
#define BOOST_PROCESS_EXTENSIONS_HPP_
|
||||
|
||||
#include <boost/process/detail/handler.hpp>
|
||||
|
||||
#if defined(BOOST_WINDOWS_API)
|
||||
#include <boost/process/detail/windows/executor.hpp>
|
||||
#include <boost/process/detail/windows/async_handler.hpp>
|
||||
#else
|
||||
#include <boost/process/detail/windows/executor.hpp>
|
||||
#include <boost/process/detail/windows/async_handler.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace process {
|
||||
namespace asio {
|
||||
class io_service;
|
||||
}
|
||||
namespace detail {
|
||||
template<typename Tuple>
|
||||
inline asio::io_service& get_io_service(const Tuple & tup);
|
||||
}
|
||||
|
||||
|
||||
///Namespace for extensions @attention This is experimental.
|
||||
namespace extend {
|
||||
|
||||
#if defined(BOOST_WINDOWS_API)
|
||||
|
||||
template<typename ...Args>
|
||||
using windows_executor = ::boost::process::detail::windows::executor<Args...>;
|
||||
template<typename ...Args>
|
||||
struct posix_executor;
|
||||
|
||||
#else
|
||||
|
||||
template<typename ...Args>
|
||||
using posix_executor = ::boost::process::detail::posix::executor<Args...>;
|
||||
template<typename ...Args>
|
||||
struct windows_executor;
|
||||
|
||||
#endif
|
||||
|
||||
using ::boost::process::detail::handler;
|
||||
using ::boost::process::detail::api::require_io_service;
|
||||
using ::boost::process::detail::api::async_handler;
|
||||
|
||||
constexpr boost::process::detail::make_handler_t<boost::process::detail::on_setup_> on_setup;
|
||||
constexpr boost::process::detail::make_handler_t<boost::process::detail::on_error_> on_error;
|
||||
constexpr boost::process::detail::make_handler_t<boost::process::detail::on_success_> on_success;
|
||||
|
||||
#if defined(BOOST_POSIX_API)
|
||||
///This handler is invoked if the fork fails.
|
||||
constexpr static ::boost::process::detail::make_handler_t<::boost::process::detail::posix::on_fork_error_ > on_fork_error;
|
||||
///This handler is invoked if the fork succeeded.
|
||||
constexpr static ::boost::process::detail::make_handler_t<::boost::process::detail::posix::on_exec_setup_ > on_exec_setup;
|
||||
///This handler is invoked if the exec call errored.
|
||||
constexpr static ::boost::process::detail::make_handler_t<::boost::process::detail::posix::on_exec_error_ > on_exec_error;
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -50,12 +50,7 @@ namespace posix {
|
||||
*
|
||||
*/
|
||||
constexpr static ::boost::process::detail::posix::fd_ fd;
|
||||
///This handler is invoked if the fork fails.
|
||||
constexpr static ::boost::process::detail::make_handler_t<::boost::process::detail::posix::on_fork_error_ > on_fork_error;
|
||||
///This handler is invoked if the fork succeeded.
|
||||
constexpr static ::boost::process::detail::make_handler_t<::boost::process::detail::posix::on_exec_setup_ > on_exec_setup;
|
||||
///This handler is invoked if the exec call errored.
|
||||
constexpr static ::boost::process::detail::make_handler_t<::boost::process::detail::posix::on_exec_error_ > on_exec_error;
|
||||
|
||||
/** This property lets you modify the handling of `SIGCHLD` for this call. It will be reset afterwards.
|
||||
|
||||
It can be set to default, by the expression `sig.dfl()`, set to ignore with `sig.ign()` or
|
||||
|
||||
Reference in New Issue
Block a user