From b14b3b0545827f91239aa057e6e381e2d1063c13 Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Tue, 19 Nov 2024 16:36:40 -0500 Subject: [PATCH] fix: support for upcoming Boost 1.87.0 io_service was deprecated and replaced by io_context in 1.66.0[^1]. The upcoming Boost 1.87.0 will remove the deprecated API[^2]. [^1]: https://github.com/boostorg/asio/commit/b60e92b13ef68dfbb9af180d76eae41d22e19356 [^2]: https://github.com/boostorg/asio/commit/ec0908c562102915423d8bd7aefd3079efbb6c86 --- src/tool/pager.cpp | 4 ++-- test/tools_test.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/tool/pager.cpp b/src/tool/pager.cpp index bdeeaac28..2efd5c35b 100644 --- a/src/tool/pager.cpp +++ b/src/tool/pager.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include @@ -79,7 +79,7 @@ std::optional find_pager_program(os_access const& os) { } void show_in_pager(pager_program const& pager, std::string text) { - boost::asio::io_service ios; + boost::asio::io_context ios; bp::child proc(pager.name.wstring(), bp::args(pager.args), bp::std_in = boost::asio::const_buffer(text.data(), text.size()), diff --git a/test/tools_test.cpp b/test/tools_test.cpp index 385e506d5..28ed86312 100644 --- a/test/tools_test.cpp +++ b/test/tools_test.cpp @@ -45,7 +45,7 @@ #endif #endif -#include +#include #include #include @@ -360,7 +360,7 @@ class subprocess { : subprocess(nullptr, prog, std::forward(args)...) {} template - subprocess(boost::asio::io_service& ios, std::filesystem::path const& prog, + subprocess(boost::asio::io_context& ios, std::filesystem::path const& prog, Args&&... args) : subprocess(&ios, prog, std::forward(args)...) {} @@ -382,7 +382,7 @@ class subprocess { void run() { if (!ios_) { - throw std::runtime_error("processes with external io_service must be run " + throw std::runtime_error("processes with external io_context must be run " "externally and then waited for"); } ios_->run(); @@ -450,7 +450,7 @@ class subprocess { private: template - subprocess(boost::asio::io_service* ios, std::filesystem::path const& prog, + subprocess(boost::asio::io_context* ios, std::filesystem::path const& prog, Args&&... args) : prog_{prog} { (append_arg(cmdline_, std::forward(args)), ...); @@ -458,7 +458,7 @@ class subprocess { ignore_sigpipe(); if (!ios) { - ios_ = std::make_unique(); + ios_ = std::make_unique(); ios = ios_.get(); } @@ -492,7 +492,7 @@ class subprocess { } bp::child c_; - std::unique_ptr ios_; + std::unique_ptr ios_; std::future out_; std::future err_; std::string outs_;