2
0
mirror of https://github.com/boostorg/process.git synced 2026-01-20 04:42:24 +00:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Klemens Morgenstern
3ad4fd3ccf zombie reap fix. 2023-08-14 18:00:55 +08:00
SilverPlate3
502dc48753 Pass empty argument
closes #256
2023-08-14 17:47:17 +08:00
Ed Tanous
402acc151a Use boost::throw_exception
Using boost::throw_exception allows for modifications to these
exceptions on a per-application basis, including overriding with custom
implementations.

This also has the benefit of allowing compilation with -fno-exceptions
set, which should make this code more portable.
2023-08-14 17:41:37 +08:00
Roberto Rodriguez
0503b0997c Fix compilation with -Wall and -Werror 2023-08-14 17:41:00 +08:00
Klemens Morgenstern
8d372cb510 v2::environment link fixes 2023-08-14 17:28:54 +08:00
5 changed files with 27 additions and 12 deletions

View File

@@ -21,7 +21,9 @@
#include <system_error>
#include <boost/system/api_config.hpp>
#include <boost/throw_exception.hpp>
#include <boost/process/exception.hpp>
#include <boost/assert/source_location.hpp>
#if defined(BOOST_POSIX_API)
#include <errno.h>
@@ -71,31 +73,33 @@ inline std::error_code get_last_error() noexcept
}
#endif
inline void throw_last_error(const std::string & msg)
inline void throw_last_error(const std::string & msg, boost::source_location const & loc = boost::source_location())
{
throw process_error(get_last_error(), msg);
boost::throw_exception(process_error(get_last_error(), msg), loc);
}
inline void throw_last_error(const char * msg)
inline void throw_last_error(const char * msg, boost::source_location const & loc = boost::source_location())
{
throw process_error(get_last_error(), msg);
boost::throw_exception(process_error(get_last_error(), msg), loc);
}
inline void throw_last_error()
inline void throw_last_error(boost::source_location const & loc = boost::source_location())
{
throw process_error(get_last_error());
boost::throw_exception(process_error(get_last_error()), loc);
}
inline void throw_error(const std::error_code& ec)
inline void throw_error(const std::error_code& ec,
boost::source_location const & loc = boost::source_location())
{
if (ec)
throw process_error(ec);
boost::throw_exception(process_error(ec), loc);
}
inline void throw_error(const std::error_code& ec, const char* msg)
inline void throw_error(const std::error_code& ec, const char* msg,
boost::source_location const & loc = boost::source_location())
{
if (ec)
throw process_error(ec, msg);
boost::throw_exception(process_error(ec, msg), loc);
}
template<typename Char> constexpr Char null_char();

View File

@@ -71,7 +71,7 @@ struct async_out_buffer : ::boost::process::detail::posix::handler_base_ext,
}
template <typename Executor>
inline void on_success(Executor &exec)
inline void on_success(Executor &)
{
auto pipe = this->pipe;
boost::asio::async_read(*pipe, buf,

View File

@@ -445,7 +445,7 @@ child executor<Sequence>::invoke(boost::mpl::false_, boost::mpl::false_)
if (_ec)
{
//if an error occurred we need to reap the child process
::waitpid(this->pid, nullptr, WNOHANG);
::waitpid(this->pid, nullptr, 0);
boost::fusion::for_each(seq, call_on_error(*this, _ec));
return child();
}

View File

@@ -61,6 +61,10 @@ inline std::string build_args(const std::string & exe, std::vector<std::string>
arg += '"';
}
}
else
{
arg = "\"\"";
}
if (!st.empty())//first one does not need a preceding space
st += ' ';
@@ -105,6 +109,10 @@ inline std::wstring build_args(const std::wstring & exe, std::vector<std::wstrin
arg += '"';
}
}
else
{
arg = L"\"\"";
}
if (!st.empty())//first one does not need a preceding space
st += L' ';

View File

@@ -1805,6 +1805,7 @@ struct process_environment
}
BOOST_PROCESS_V2_DECL
error_code on_setup(posix::default_launcher & launcher,
const filesystem::path &, const char * const *);
@@ -1886,6 +1887,8 @@ struct hash<BOOST_PROCESS_V2_NAMESPACE::environment::key_value_pair>
#if defined(BOOST_PROCESS_V2_HEADER_ONLY)
#include <boost/process/v2/impl/environment.ipp>
#include <boost/process/v2/detail/impl/environment.ipp>
#endif