|
| 1 | +diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 2 | +--- a/CMakeLists.txt |
| 3 | ++++ b/CMakeLists.txt |
| 4 | +@@ -384,7 +384,7 @@ |
| 5 | + # boost::process was introduced first in version 1.64.0, |
| 6 | + # boost::beast::detail::base64 was introduced first in version 1.66.0 |
| 7 | + set(MINIMUM_BOOST_VERSION "1.66.0") |
| 8 | +-set(_boost_components "system;filesystem;thread;log;locale;regex;chrono;atomic;date_time;iostreams") |
| 9 | ++set(_boost_components "filesystem;thread;log;locale;regex;chrono;atomic;date_time;iostreams;process") |
| 10 | + find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS ${_boost_components}) |
| 11 | + # boost compile only in release & debug. We have to force the release version for RELWITHDEBINFO compilation |
| 12 | + if (MSVC) |
| 13 | +diff --git a/src/libslic3r/GCode/PostProcessor.cpp b/src/libslic3r/GCode/PostProcessor.cpp |
| 14 | +--- a/src/libslic3r/GCode/PostProcessor.cpp |
| 15 | ++++ b/src/libslic3r/GCode/PostProcessor.cpp |
| 16 | +@@ -29,6 +29,8 @@ |
| 17 | + // POSIX |
| 18 | + #include <sstream> |
| 19 | + #include <boost/process.hpp> |
| 20 | ++#include <boost/process/v1/child.hpp> |
| 21 | ++#include <boost/process/v1/io.hpp> |
| 22 | + #include <unistd.h> //readlink |
| 23 | + #endif |
| 24 | + |
| 25 | +@@ -228,8 +230,8 @@ |
| 26 | + command_line.push_back('\''); |
| 27 | + |
| 28 | + BOOST_LOG_TRIVIAL(trace) << boost::format("Executing script, shell: %1%, command: %2%") % shell % command_line; |
| 29 | +- process::ipstream istd_err; |
| 30 | +- process::child child(shell, "-c", command_line, process::std_err > istd_err); |
| 31 | ++ boost::process::v1::ipstream istd_err; |
| 32 | ++ boost::process::v1::child child(shell, "-c", command_line, boost::process::v1::std_err > istd_err); |
| 33 | + |
| 34 | + std_err.clear(); |
| 35 | + std::string line; |
| 36 | +diff --git a/src/slic3r/GUI/FreeCADDialog.cpp b/src/slic3r/GUI/FreeCADDialog.cpp |
| 37 | +--- a/src/slic3r/GUI/FreeCADDialog.cpp |
| 38 | ++++ b/src/slic3r/GUI/FreeCADDialog.cpp |
| 39 | +@@ -45,6 +45,11 @@ |
| 40 | + // note: don't put it in a header, as it can create problems. Here it's safe enough to be used, as it's just applied for the process.hpp file and this source code. |
| 41 | + #define pid_t pid_t |
| 42 | + #include <boost/process.hpp> |
| 43 | ++#include <boost/process/v1/child.hpp> |
| 44 | ++#include <boost/process/v1/io.hpp> |
| 45 | ++#include <boost/process/v1/pipe.hpp> |
| 46 | ++#include <boost/process/v1/async.hpp> |
| 47 | ++ |
| 48 | + |
| 49 | + #include <cstdlib> // getenv() |
| 50 | + |
| 51 | +@@ -63,11 +68,12 @@ |
| 52 | + //now that we have process.hpp, we can define the ExecVar |
| 53 | + class ExecVar { |
| 54 | + public: |
| 55 | +- boost::process::opstream pyin; |
| 56 | ++ boost::process::v1::opstream pyin; |
| 57 | ++#include <boost/process/v1/io.hpp> |
| 58 | + boost::asio::io_context ios; |
| 59 | + std::future<std::string> data_out; |
| 60 | + std::future<std::string> data_err; |
| 61 | +- std::unique_ptr<boost::process::child> process; |
| 62 | ++ std::unique_ptr<boost::process::v1::child> process; |
| 63 | + }; |
| 64 | + |
| 65 | + //TODO: auto tab |
| 66 | +@@ -843,8 +849,8 @@ |
| 67 | + get_string_from_web_async("https://api.github.com/repos/supermerill/FreePySCAD/commits/master", this, &FreeCADDialog::test_update_script_file); |
| 68 | + } |
| 69 | + |
| 70 | +- exec_var->process.reset(new boost::process::child(pythonpath.string() + " -u -i", boost::process::std_in < exec_var->pyin, |
| 71 | +- boost::process::std_out > exec_var->data_out, boost::process::std_err > exec_var->data_err, exec_var->ios)); |
| 72 | ++ exec_var->process.reset(new boost::process::v1::child(pythonpath.string() + " -u -i", boost::process::v1::std_in < exec_var->pyin, |
| 73 | ++ boost::process::v1::std_out > exec_var->data_out, boost::process::v1::std_err > exec_var->data_err, exec_var->ios)); |
| 74 | + exec_var->pyin << "import sys" << std::endl; |
| 75 | + // add freecad lib path if not already done |
| 76 | + exec_var->pyin << "sys.path.append('" << (freecadpath / "lib").string() << "')" << std::endl; |
| 77 | +diff --git a/src/slic3r/GUI/RemovableDriveManager.cpp b/src/slic3r/GUI/RemovableDriveManager.cpp |
| 78 | +--- a/src/slic3r/GUI/RemovableDriveManager.cpp |
| 79 | ++++ b/src/slic3r/GUI/RemovableDriveManager.cpp |
| 80 | +@@ -36,6 +36,9 @@ |
| 81 | + #include <boost/filesystem.hpp> |
| 82 | + #include <boost/system/error_code.hpp> |
| 83 | + #include <boost/process.hpp> |
| 84 | ++#include <boost/process/v1/child.hpp> |
| 85 | ++#include <boost/process/v1/io.hpp> |
| 86 | ++#include <boost/process/v1/search_path.hpp> |
| 87 | + #endif |
| 88 | + |
| 89 | + namespace Slic3r { |
| 90 | +@@ -859,15 +862,15 @@ |
| 91 | + // but neither triggers "succesful safe removal messege" |
| 92 | + |
| 93 | + BOOST_LOG_TRIVIAL(info) << "Ejecting started"; |
| 94 | +- boost::process::ipstream istd_err; |
| 95 | +- boost::process::child child( |
| 96 | ++ boost::process::v1::ipstream istd_err; |
| 97 | ++ boost::process::v1::child child( |
| 98 | + #if __APPLE__ |
| 99 | +- boost::process::search_path("diskutil"), "eject", correct_path.c_str(), (boost::process::std_out & boost::process::std_err) > istd_err); |
| 100 | ++ boost::process::v1::search_path("diskutil"), "eject", correct_path.c_str(), (boost::process::v1::std_out & boost::process::v1::std_err) > istd_err); |
| 101 | + //Another option how to eject at mac. Currently not working. |
| 102 | + //used insted of system() command; |
| 103 | + //this->eject_device(correct_path); |
| 104 | + #else |
| 105 | +- boost::process::search_path("umount"), correct_path.c_str(), (boost::process::std_out & boost::process::std_err) > istd_err); |
| 106 | ++ boost::process::v1::search_path("umount"), correct_path.c_str(), (boost::process::v1::std_out & boost::process::v1::std_err) > istd_err); |
| 107 | + #endif |
| 108 | + std::string line; |
| 109 | + while (child.running() && std::getline(istd_err, line)) { |
| 110 | +@@ -881,7 +884,7 @@ |
| 111 | + // The wait call can fail, as it did in https://github.com/prusa3d/PrusaSlicer/issues/5507 |
| 112 | + // It can happen even in cases where the eject is sucessful, but better report it as failed. |
| 113 | + // We did not find a way to reliably retrieve the exit code of the process. |
| 114 | +- BOOST_LOG_TRIVIAL(error) << "boost::process::child::wait() failed during Ejection. State of Ejection is unknown. Error code: " << ec.value(); |
| 115 | ++ BOOST_LOG_TRIVIAL(error) << "boost::process::v1::child::wait() failed during Ejection. State of Ejection is unknown. Error code: " << ec.value(); |
| 116 | + } else { |
| 117 | + int err = child.exit_code(); |
| 118 | + if (err) { |
0 commit comments