2
0
mirror of https://github.com/boostorg/process.git synced 2026-01-21 17:12:19 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Klemens David Morgenstern
6abce365c5 started on asio_no_deprecated.cpp 2018-03-11 20:57:18 +01:00
16 changed files with 42 additions and 69 deletions

View File

@@ -296,7 +296,7 @@ provided we also pass a reference to an io_service.
```
io_service ios;
std::vector<char> buf(4096);
std::vector<char> buf;
bp::child c(bp::search_path("g++"), "main.cpp", bp::std_out > asio_buffer(buf), ios);

View File

@@ -82,7 +82,7 @@ struct async_system_handler : ::boost::process::detail::api::async_handler
{
#if defined(BOOST_POSIX_API)
if (errored)
return [](int , const std::error_code &){};
return [](int exit_code, const std::error_code & ec){};
#endif
auto & h = init.completion_handler;
return [h](int exit_code, const std::error_code & ec) mutable

View File

@@ -39,7 +39,7 @@ struct async_in_buffer : ::boost::process::detail::posix::handler_base_ext,
{
}
template <typename Executor>
inline void on_success(Executor)
inline void on_success(Executor &exec)
{
auto pipe = this->pipe;
if (this->promise)
@@ -60,7 +60,7 @@ struct async_in_buffer : ::boost::process::detail::posix::handler_base_ext,
}
else
boost::asio::async_write(*pipe, buf,
[pipe](const boost::system::error_code&, std::size_t){});
[pipe](const boost::system::error_code&ec, std::size_t size){});
std::move(*pipe).source().close();

View File

@@ -61,7 +61,7 @@ struct async_out_buffer : ::boost::process::detail::posix::handler_base_ext,
{
auto pipe = this->pipe;
boost::asio::async_read(*pipe, buf,
[pipe](const boost::system::error_code&, std::size_t){});
[pipe](const boost::system::error_code&, std::size_t size){});
this->pipe = nullptr;
std::move(*pipe).sink().close();
@@ -112,7 +112,7 @@ struct async_out_future : ::boost::process::detail::posix::handler_base_ext,
fut = promise->get_future();
}
template <typename Executor>
inline void on_success(Executor &)
inline void on_success(Executor &exec)
{
auto pipe = this->pipe;
@@ -120,7 +120,7 @@ struct async_out_future : ::boost::process::detail::posix::handler_base_ext,
auto promise = this->promise;
boost::asio::async_read(*pipe, *buffer,
[pipe, buffer, promise](const boost::system::error_code& ec, std::size_t)
[pipe, buffer, promise](const boost::system::error_code& ec, std::size_t size)
{
if (ec && (ec.value() != ENOENT))
{

View File

@@ -125,18 +125,6 @@ public:
return _sink.write_some(buffers);
}
template<typename MutableBufferSequence>
std::size_t read_some(const MutableBufferSequence & buffers, boost::system::error_code & ec) noexcept
{
return _source.read_some(buffers, ec);
}
template<typename MutableBufferSequence>
std::size_t write_some(const MutableBufferSequence & buffers, boost::system::error_code & ec) noexcept
{
return _sink.write_some(buffers, ec);
}
native_handle_type native_source() const {return const_cast<boost::asio::posix::stream_descriptor&>(_source).native_handle();}
native_handle_type native_sink () const {return const_cast<boost::asio::posix::stream_descriptor&>(_sink ).native_handle();}
@@ -148,7 +136,7 @@ public:
const MutableBufferSequence & buffers,
ReadHandler &&handler)
{
return _source.async_read_some(buffers, std::forward<ReadHandler>(handler));
_source.async_read_some(buffers, std::forward<ReadHandler>(handler));
}
template<typename ConstBufferSequence,
@@ -159,7 +147,7 @@ public:
const ConstBufferSequence & buffers,
WriteHandler&& handler)
{
return _sink.async_write_some(buffers, std::forward<WriteHandler>(handler));
_sink.async_write_some(buffers, std::forward<WriteHandler>(handler));
}
@@ -250,8 +238,8 @@ async_pipe& async_pipe::operator=(const async_pipe & p)
int sink;
//cannot get the handle from a const object.
auto source_in = const_cast<::boost::asio::posix::stream_descriptor &>(p._source).native_handle();
auto sink_in = const_cast<::boost::asio::posix::stream_descriptor &>(p._sink).native_handle();
auto source_in = const_cast<::boost::asio::posix::stream_descriptor &>(_source).native_handle();
auto sink_in = const_cast<::boost::asio::posix::stream_descriptor &>(_sink).native_handle();
if (source_in == -1)
source = -1;
else

View File

@@ -56,7 +56,7 @@ struct group_handle
{
return ::getpgid(proc) == grp;
}
bool has(handle_t proc, std::error_code &) noexcept
bool has(handle_t proc, std::error_code & ec) noexcept
{
return ::getpgid(proc) == grp;
}

View File

@@ -104,7 +104,8 @@ void sigchld_service::_handle_signal(const boost::system::error_code & ec)
_signal_set.async_wait(
[this](const boost::system::error_code & ec, int)
{
_strand.post([this, ec]{this->_handle_signal(ec);});
_strand.post([ec]{});
this->_handle_signal(ec);
});
}
}

View File

@@ -87,7 +87,7 @@ template< class Clock, class Duration >
inline bool wait_until(
const child_handle &p,
int & exit_code,
const std::chrono::time_point<Clock, Duration>& time_out)
const std::chrono::time_point<Clock, Duration>& time_out) noexcept
{
std::error_code ec;
bool b = wait_until(p, exit_code, time_out, ec);
@@ -109,7 +109,7 @@ template< class Rep, class Period >
inline bool wait_for(
const child_handle &p,
int & exit_code,
const std::chrono::duration<Rep, Period>& rel_time)
const std::chrono::duration<Rep, Period>& rel_time) noexcept
{
std::error_code ec;
bool b = wait_for(p, exit_code, rel_time, ec);

View File

@@ -144,18 +144,6 @@ public:
return _sink.write_some(buffers);
}
template<typename MutableBufferSequence>
std::size_t read_some(const MutableBufferSequence & buffers, boost::system::error_code & ec) noexcept
{
return _source.read_some(buffers, ec);
}
template<typename MutableBufferSequence>
std::size_t write_some(const MutableBufferSequence & buffers, boost::system::error_code & ec) noexcept
{
return _sink.write_some(buffers, ec);
}
native_handle_type native_source() const {return const_cast<boost::asio::windows::stream_handle&>(_source).native_handle();}
native_handle_type native_sink () const {return const_cast<boost::asio::windows::stream_handle&>(_sink ).native_handle();}
@@ -167,7 +155,7 @@ public:
const MutableBufferSequence & buffers,
ReadHandler &&handler)
{
return _source.async_read_some(buffers, std::forward<ReadHandler>(handler));
_source.async_read_some(buffers, std::forward<ReadHandler>(handler));
}
template<typename ConstBufferSequence,
@@ -178,7 +166,7 @@ public:
const ConstBufferSequence & buffers,
WriteHandler && handler)
{
return _sink.async_write_some(buffers, std::forward<WriteHandler>(handler));
_sink.async_write_some(buffers, std::forward<WriteHandler>(handler));
}
const handle_type & sink () const & {return _sink;}

View File

@@ -82,7 +82,7 @@ typedef struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION_ {
_Out_opt_ LPDWORD lpReturnLength
);
*/
typedef ::boost::winapi::BOOL_ (*query_information_job_object_p)(
typedef ::boost::winapi::BOOL_ ( WINAPI *query_information_job_object_p)(
::boost::winapi::HANDLE_,
JOBOBJECTINFOCLASS_,
void *,
@@ -90,7 +90,7 @@ typedef ::boost::winapi::BOOL_ (*query_information_job_object_p)(
::boost::winapi::DWORD_ *);
inline ::boost::winapi::BOOL_ query_information_job_object(
inline ::boost::winapi::BOOL_ WINAPI query_information_job_object(
::boost::winapi::HANDLE_ hJob,
JOBOBJECTINFOCLASS_ JobObjectInfoClass,
void * lpJobObjectInfo,
@@ -110,7 +110,7 @@ inline ::boost::winapi::BOOL_ query_information_job_object(
_In_ DWORD cbJobObjectInfoLength
);*/
typedef ::boost::winapi::BOOL_ (*set_information_job_object_p)(
typedef ::boost::winapi::BOOL_ ( WINAPI *set_information_job_object_p)(
::boost::winapi::HANDLE_,
JOBOBJECTINFOCLASS_,
void *,
@@ -118,7 +118,7 @@ typedef ::boost::winapi::BOOL_ (*set_information_job_object_p)(
}
inline ::boost::winapi::BOOL_ set_information_job_object(
inline ::boost::winapi::BOOL_ WINAPI set_information_job_object(
::boost::winapi::HANDLE_ hJob,
JOBOBJECTINFOCLASS_ JobObjectInfoClass,
void * lpJobObjectInfo,

View File

@@ -55,9 +55,9 @@ inline boost::filesystem::path search_path(
for (auto & ext : extensions)
boost::to_lower(ext);
for (const boost::filesystem::path & pp_ : path)
for (const boost::filesystem::path & pp : path)
{
auto p = pp_ / filename;
auto p = pp / filename;
for (boost::filesystem::path ext : extensions)
{
boost::filesystem::path pp = p;

View File

@@ -34,7 +34,7 @@ struct create_no_window_ : public ::boost::process::detail::handler_base
template <class Executor>
void on_setup(Executor &exec) const
{
exec.creation_flags |= ::boost::winapi::CREATE_NO_WINDOW_;
exec.creation_flags |= ::boost::detail::winapi::CREATE_NO_WINDOW_;
}
};

View File

@@ -94,8 +94,8 @@ struct entry : const_entry<Char, Environment>
explicit entry(string_type&& name, pointer data, environment_t & env) :
father(std::move(name), data, env) {}
explicit entry(string_type &&name, environment_t & env_) :
father(std::move(name), env_) {}
explicit entry(string_type &&name, environment_t & env) :
father(std::move(name), env) {}
entry(const entry&) = default;
entry& operator=(const entry&) = default;

View File

@@ -26,28 +26,10 @@ namespace boost {
</programlisting>
\endxmlonly
*/
namespace boost {
namespace filesystem { class path; }
namespace process {
namespace detail {
namespace boost { namespace process { namespace detail {
struct exe_
{
template<typename = void>
inline exe_setter_<typename boost::filesystem::path::value_type> operator()(const boost::filesystem::path & pth) const
{
return exe_setter_<typename boost::filesystem::path::value_type>(pth.native());
}
template<typename = void>
inline exe_setter_<typename boost::filesystem::path::value_type> operator=(const boost::filesystem::path & pth) const
{
return exe_setter_<typename boost::filesystem::path::value_type>(pth.native());
}
template<typename Char>
inline exe_setter_<Char> operator()(const Char *s) const
{

View File

@@ -59,6 +59,7 @@ test-suite bare :
[ compile no_ansi_apps.cpp ]
[ compile-fail spawn_fail.cpp ]
[ compile-fail async_system_fail.cpp ]
[ compile asio_no_deprecated.cpp ]
;
test-suite with-valgrind :

View File

@@ -0,0 +1,13 @@
//
// Created by kleme on 26.02.2018.
//
#define BOOST_ASIO_NO_DEPRECATED 1
#include <boost/process.hpp>
int main() {}
#if defined(BOOST_POSIX_API)
#include <boost/process/posix.hpp>
#elif
#include <boost/process/windows.hpp>
#endif