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

Compare commits

..

1 Commits

Author SHA1 Message Date
Klemens Morgenstern
9ed2fef8cd Fixed wrong type in probe_on_error on windows.
Closes #491.
2025-05-24 09:40:16 +08:00
16 changed files with 34 additions and 48 deletions

View File

@@ -23,19 +23,19 @@ jobs:
include:
- { toolset: gcc-5, cxxstd: "11,14,1z", os: ubuntu-latest, container: 'ubuntu:18.04', install: g++-5 }
- { toolset: gcc-6, cxxstd: "11,14,1z", os: ubuntu-latest, container: 'ubuntu:18.04', install: g++-6 }
- { toolset: gcc-7, cxxstd: "11,14,17", os: ubuntu-latest, container: 'ubuntu:20.04', install: g++-7 }
- { toolset: gcc-7, cxxstd: "11,14,17", os: ubuntu-20.04, install: g++-7 }
- { toolset: gcc-10, cxxstd: "11,14,17,2a", os: ubuntu-22.04, install: g++-10 }
- { toolset: gcc-12, cxxstd: "11,14,17,20,2b", os: ubuntu-22.04, install: g++-12 }
- { toolset: clang, compiler: clang++-3.9, cxxstd: "11,14", os: ubuntu-latest, container: 'ubuntu:18.04', install: clang-3.9 }
- { toolset: clang, compiler: clang++-4.0, cxxstd: "11,14", os: ubuntu-latest, container: 'ubuntu:18.04', install: clang-4.0 }
- { toolset: clang, compiler: clang++-5.0, cxxstd: "11,14,1z", os: ubuntu-latest, container: 'ubuntu:18.04', install: clang-5.0 }
- { toolset: clang, compiler: clang++-6.0, cxxstd: "11,14,17", os: ubuntu-latest, container: 'ubuntu:20.04', install: clang-6.0 }
- { toolset: clang, compiler: clang++-7, cxxstd: "11,14,17", os: ubuntu-latest, container: 'ubuntu:20.04', install: clang-7 }
- { toolset: clang, compiler: clang++-8, cxxstd: "11,14,17", os: ubuntu-latest, container: 'ubuntu:20.04', install: clang-8 }
- { toolset: clang, compiler: clang++-9, cxxstd: "11,14,17,2a", os: ubuntu-latest, container: 'ubuntu:20.04', install: clang-9 }
- { toolset: clang, compiler: clang++-10, cxxstd: "11,14,17,2a", os: ubuntu-latest, container: 'ubuntu:20.04', install: clang-10 }
- { toolset: clang, compiler: clang++-11, cxxstd: "11,14,17,2a", os: ubuntu-22.04, install: clang-11 }
- { toolset: clang, compiler: clang++-12, cxxstd: "11,14,17,2a", os: ubuntu-22.04, install: clang-12 }
- { toolset: clang, compiler: clang++-6.0, cxxstd: "11,14,17", os: ubuntu-20.04, install: clang-6.0 }
- { toolset: clang, compiler: clang++-7, cxxstd: "11,14,17", os: ubuntu-20.04, install: clang-7 }
- { toolset: clang, compiler: clang++-8, cxxstd: "11,14,17", os: ubuntu-20.04, install: clang-8 }
- { toolset: clang, compiler: clang++-9, cxxstd: "11,14,17,2a", os: ubuntu-20.04, install: clang-9 }
- { toolset: clang, compiler: clang++-10, cxxstd: "11,14,17,2a", os: ubuntu-20.04, install: clang-10 }
- { toolset: clang, compiler: clang++-11, cxxstd: "11,14,17,2a", os: ubuntu-20.04, install: clang-11 }
- { toolset: clang, compiler: clang++-12, cxxstd: "11,14,17,2a", os: ubuntu-20.04, install: clang-12 }
- { toolset: clang, compiler: clang++-13, cxxstd: "11,14,17,20,2b", os: ubuntu-22.04, install: clang-13 }
- { toolset: clang, compiler: clang++-14, cxxstd: "11,14,17,20,2b", os: ubuntu-22.04, install: clang-14 }
- { toolset: clang, cxxstd: "11,14,17,2a", os: macos-13 }

View File

@@ -8,6 +8,6 @@ A special thank you goes to [http://www.intra2net.com/(Intra2net AG) (especially
Great thanks also goes to Boris Schaeling, who despite having boost.process rejected, went on to work on it and maintained it up until this day and participated in the development of the current version.
Many Thanks, to [https://github.com/samuelvenable](Samuel Venable) for contributing the <<v2::ext>> functionality and all the research that went into it.
Many Thanks, to [https://github.com/time-killer-games](Samuel Venable) for contributing the <<v2::ext>> functionality and all the research that went into it.

View File

@@ -3,7 +3,7 @@
=== `environment`
The `environment` header provides facilities to manipulate the current environment and set it for new processes.
The `environment` header provides facilities to maniuplate the current environment and set it for new processes.
An environment is a a `range` of `T` fulfilling these requirements:
@@ -22,7 +22,7 @@ namespace environment
// A char traits type that reflects the OS rules for string representing environment keys.
/* Can be an alias of std::char_traits. May only be defined for `char` and `wchar_t`.
*
* Windows treats keys as case-insensitive yet preserving. The char traits are made to reflect
* Windows treats keys as case-insensitive yet perserving. The char traits are made to reflect
* that behaviour.
*/
template<typename Char>

View File

@@ -13,7 +13,7 @@ The major changes are
* separate compilation
* fd safe by default
Version 2 is now the default. In order to discourage usage of the deprecated v1, it's documentation has been removed.
Version 2 is now the defauled. In order to discourage usage of the deprecated v1, it's documentation has been removed.
== Simplified Interface

View File

@@ -114,7 +114,7 @@ io_context ios;
child c("ls", ios, on_exit=[](int exit, const std::error_code& ec_in){});
std::future<int> exit_code;
child c2("ls", ios, on_exit=exit_code);
chlid c2("ls", ios, on_exit=exit_code);
\endcode

View File

@@ -26,7 +26,7 @@ namespace boost { namespace process { BOOST_PROCESS_V1_INLINE namespace v1 {
#if defined(BOOST_PROCESS_DOXYGEN)
/** Class implementing an asynchronous I/O-Object for use with boost.asio.
/** Class implementing an asnychronous I/O-Object for use with boost.asio.
* It is based on the corresponding I/O Object, that is either boost::asio::windows::stream_handle or
* boost::asio::posix::stream_descriptor.
*

View File

@@ -128,7 +128,7 @@ class child
/** Same as valid, for convenience. */
explicit operator bool() const;
/** Check if the the child process is in any process group. */
/** Check if the the chlid process is in any process group. */
bool in_group() const;
/** \overload bool in_group() const */

View File

@@ -319,7 +319,7 @@ struct basic_process_handle_signal
}
template<typename Self>
void operator()(Self &&self, error_code ec, int /*sig*/)
void operator()(Self &&self, error_code ec, int sig)
{
if (ec == net::error::operation_aborted &&
self.get_cancellation_state().cancelled()

View File

@@ -40,7 +40,7 @@ namespace environment
/// A char traits type that reflects the OS rules for string representing environment keys.
/** Can be an alias of std::char_traits. May only be defined for `char` and `wchar_t`.
*
* Windows treats keys as case-insensitive yet preserving. The char traits are made to reflect
* Windows treats keys as case-insensitive yet perserving. The char traits are made to reflect
* that behaviour.
*/
template<typename Char>
@@ -1372,8 +1372,6 @@ struct current_view
environment::native_iterator iterator_;
};
using const_iterator = iterator;
iterator begin() const {return iterator(handle_.get());}
iterator end() const {return iterator(detail::find_end(handle_.get()));}

View File

@@ -355,7 +355,8 @@ private:
}
};
net::post(handle.get_executor(), completer{static_cast<int>(res), std::move(self)});
net::post(handle.get_executor(),
completer{static_cast<int>(res), std::move(self)});
}
else
handle.async_wait(std::move(self));
@@ -370,10 +371,7 @@ private:
{
if (!ec)
res = code;
else if (ec == boost::system::errc::no_child_process)
std::move(self).complete({}, evaluate_exit_code(res));
else
std::move(self).complete(ec, evaluate_exit_code(code));
std::move(self).complete(ec, evaluate_exit_code(code));
}
}
};

View File

@@ -130,8 +130,8 @@ struct process_io_binding
template<typename ReadablePipe>
process_io_binding(ReadablePipe & pipe,
typename std::enable_if<is_readable_pipe<ReadablePipe>::value && Target != STD_INPUT_HANDLE>::type * = nullptr)
process_io_binding(ReadablePipe & readable_pipe,
typename std::enable_if<is_readable_pipe<ReadablePipe>::value && Target != STDIN_FILENO>::type * = nullptr)
{
net::detail::native_pipe_handle p[2];
error_code ec;
@@ -145,8 +145,8 @@ struct process_io_binding
template<typename WritablePipe>
process_io_binding(WritablePipe & pipe,
typename std::enable_if<is_writable_pipe<WritablePipe>::value && Target == STD_INPUT_HANDLE>::type * = nullptr)
process_io_binding(WritablePipe & writable_pipe,
typename std::enable_if<is_writable_pipe<WritablePipe>::value && Target == STDIN_FILENO>::type * = nullptr)
{
net::detail::native_pipe_handle p[2];
error_code ec;
@@ -267,7 +267,7 @@ struct process_io_binding
return ec;
}
error_code on_exec_setup(posix::default_launcher &,
error_code on_exec_setup(posix::default_launcher & launcher,
const filesystem::path &, const char * const *)
{
if (::dup2(fd, target) == -1)

View File

@@ -54,8 +54,6 @@ std::size_t size_as_utf8(const wchar_t * in, std::size_t size, error_code & ec)
std::size_t size_as_wide(const char * in, std::size_t size, error_code & ec)
{
if (size == 0u)
return 0u;
auto res = ::MultiByteToWideChar(
CP_UTF8, // CodePage
0, // dwFlags
@@ -90,8 +88,6 @@ std::size_t convert_to_utf8(const wchar_t *in, std::size_t size, char * out,
std::size_t convert_to_wide(const char *in, std::size_t size, wchar_t * out,
std::size_t max_size, error_code & ec)
{
if (size == 0u)
return 0u;
auto res = ::MultiByteToWideChar(
CP_UTF8, // CodePage
0, // dwFlags

View File

@@ -31,7 +31,7 @@
#endif
#endif
#if (defined(__linux__) || defined(__ANDROID__) || defined(__gnu_hurd__))
#if (defined(__linux__) || defined(__ANDROID__))
#include <cstdio>
#endif
@@ -211,7 +211,7 @@ shell cmd(boost::process::v2::pid_type pid, error_code & ec)
return make_cmd_shell_::make(std::move(procargs), argc, argv.release(), fr_func);
}
#elif (defined(__linux__) || defined(__ANDROID__) || defined(__gnu_hurd__))
#elif (defined(__linux__) || defined(__ANDROID__))
shell cmd(boost::process::v2::pid_type pid, error_code & ec)
{
@@ -403,10 +403,10 @@ shell cmd(boost::process::v2::pid_type pid, error_code & ec)
}
#else
shell cmd(boost::process::v2::pid_type, error_code & ec)
filesystem::path cmd(boost::process::v2::pid_type, error_code & ec)
{
BOOST_PROCESS_V2_ASSIGN_EC(ec, ENOTSUP, system_category());
return {};
return "";
}
#endif

View File

@@ -246,7 +246,7 @@ env_view env(boost::process::v2::pid_type pid, error_code & ec)
return {};
}
#elif (defined(__APPLE__) && defined(__MACH__)) && !TARGET_OS_IOS
#elif (defined(__APPLE___) || defined(__MACH__)) && !TARGET_OS_IOS
env_view env(boost::process::v2::pid_type pid, error_code & ec)
{
@@ -309,7 +309,7 @@ env_view env(boost::process::v2::pid_type pid, error_code & ec)
return ev;
}
#elif (defined(__linux__) || defined(__ANDROID__)) || defined(__gnu_hurd__)
#elif (defined(__linux__) || defined(__ANDROID__))
env_view env(boost::process::v2::pid_type pid, error_code & ec)
{

View File

@@ -179,6 +179,7 @@ std::vector<pid_type> child_pids(pid_type pid, error_code & ec)
{
std::vector<pid_type> vec;
#if defined(PROC_PPID_ONLY)
vec.resize(proc_listpids(PROC_PPID_ONLY, (uint32_t)pid, nullptr, 0) / sizeof(pid_type));
const auto sz = proc_listpids(PROC_PPID_ONLY, (uint32_t)pid, &vec[0], sizeof(pid_type) * vec.size());
if (sz < 0)
@@ -188,14 +189,7 @@ std::vector<pid_type> child_pids(pid_type pid, error_code & ec)
}
vec.resize(sz);
#else
std::vector<pid_type> pids = all_pids(ec);
for (std::size_t i = 0; i < pids.size(); i++)
{
if (pid == parent_pid(pids[i], ec))
{
vec.push_back(pids[i]);
}
}
BOOST_PROCESS_V2_ASSIGN_EC(ec, ENOTSUP, system_category());
#endif
return vec;
}

View File

@@ -85,7 +85,7 @@ int main(int argc, char * argv[])
{
if (kind == CTRL_CLOSE_EVENT)
{
// windows doesn't like us doing anything else
// windows doesn't like us doing antyhing else
::exit(0);
if (tim_p != nullptr)
tim_p->cancel();