From 633e45b2e2728efcb0637afa94fcbd5756dfbe76 Mon Sep 17 00:00:00 2001 From: Sebastian Falbesoner Date: Fri, 12 Apr 2024 01:42:57 +0200 Subject: remove unneeded shell option from cpp-subprocess We don't use this option and it's not supported on Windows anyways, so we can get as well rid of it. --- src/util/subprocess.hpp | 43 ------------------------------------------- 1 file changed, 43 deletions(-) (limited to 'src/util') diff --git a/src/util/subprocess.hpp b/src/util/subprocess.hpp index 0fcc9397ea..96444ad1e7 100644 --- a/src/util/subprocess.hpp +++ b/src/util/subprocess.hpp @@ -431,26 +431,6 @@ namespace util } - /*! - * Function: join - * Parameters: - * [in] vec : Vector of strings which needs to be joined to form - * a single string with words separated by a separator char. - * [in] sep : String used to separate 2 words in the joined string. - * Default constructed to ' ' (space). - * [out] string: Joined string. - */ - static inline - std::string join(const std::vector& vec, - const std::string& sep = " ") - { - std::string res; - for (auto& elem : vec) res.append(elem + sep); - res.erase(--res.end()); - return res; - } - - #ifndef __USING_WINDOWS__ /*! * Function: set_clo_on_exec @@ -696,11 +676,6 @@ struct session_leader { bool leader_ = false; }; -struct shell { - explicit shell(bool s): shell_(s) {} - bool shell_ = false; -}; - /*! * Base class for all arguments involving string value. */ @@ -1011,7 +986,6 @@ struct ArgumentDeducer void set_option(bufsize&& bsiz); void set_option(environment&& env); void set_option(defer_spawn&& defer); - void set_option(shell&& sh); void set_option(input&& inp); void set_option(output&& out); void set_option(error&& err); @@ -1350,7 +1324,6 @@ private: bool defer_process_start_ = false; bool close_fds_ = false; bool has_preexec_fn_ = false; - bool shell_ = false; bool session_leader_ = false; std::string exe_name_; @@ -1492,10 +1465,6 @@ inline void Popen::kill(int sig_num) inline void Popen::execute_process() noexcept(false) { #ifdef __USING_WINDOWS__ - if (this->shell_) { - throw OSError("shell not currently supported on windows", 0); - } - void* environment_string_table_ptr = nullptr; env_vector_t environment_string_vector; if(this->env_.size()){ @@ -1588,14 +1557,6 @@ inline void Popen::execute_process() noexcept(false) int err_rd_pipe, err_wr_pipe; std::tie(err_rd_pipe, err_wr_pipe) = util::pipe_cloexec(); - if (shell_) { - auto new_cmd = util::join(vargs_); - vargs_.clear(); - vargs_.insert(vargs_.begin(), {"/bin/sh", "-c"}); - vargs_.push_back(new_cmd); - populate_c_argv(); - } - if (exe_name_.length()) { vargs_.insert(vargs_.begin(), exe_name_); populate_c_argv(); @@ -1678,10 +1639,6 @@ namespace detail { popen_->defer_process_start_ = defer.defer; } - inline void ArgumentDeducer::set_option(shell&& sh) { - popen_->shell_ = sh.shell_; - } - inline void ArgumentDeducer::set_option(session_leader&& sleader) { popen_->session_leader_ = sleader.leader_; } -- cgit v1.2.3