Skip to content

Commit 633e45b

Browse files
committed
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.
1 parent c7567d9 commit 633e45b

File tree

1 file changed

+0
-43
lines changed

1 file changed

+0
-43
lines changed

src/util/subprocess.hpp

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -431,26 +431,6 @@ namespace util
431431
}
432432

433433

434-
/*!
435-
* Function: join
436-
* Parameters:
437-
* [in] vec : Vector of strings which needs to be joined to form
438-
* a single string with words separated by a separator char.
439-
* [in] sep : String used to separate 2 words in the joined string.
440-
* Default constructed to ' ' (space).
441-
* [out] string: Joined string.
442-
*/
443-
static inline
444-
std::string join(const std::vector<std::string>& vec,
445-
const std::string& sep = " ")
446-
{
447-
std::string res;
448-
for (auto& elem : vec) res.append(elem + sep);
449-
res.erase(--res.end());
450-
return res;
451-
}
452-
453-
454434
#ifndef __USING_WINDOWS__
455435
/*!
456436
* Function: set_clo_on_exec
@@ -696,11 +676,6 @@ struct session_leader {
696676
bool leader_ = false;
697677
};
698678

699-
struct shell {
700-
explicit shell(bool s): shell_(s) {}
701-
bool shell_ = false;
702-
};
703-
704679
/*!
705680
* Base class for all arguments involving string value.
706681
*/
@@ -1011,7 +986,6 @@ struct ArgumentDeducer
1011986
void set_option(bufsize&& bsiz);
1012987
void set_option(environment&& env);
1013988
void set_option(defer_spawn&& defer);
1014-
void set_option(shell&& sh);
1015989
void set_option(input&& inp);
1016990
void set_option(output&& out);
1017991
void set_option(error&& err);
@@ -1350,7 +1324,6 @@ class Popen
13501324
bool defer_process_start_ = false;
13511325
bool close_fds_ = false;
13521326
bool has_preexec_fn_ = false;
1353-
bool shell_ = false;
13541327
bool session_leader_ = false;
13551328

13561329
std::string exe_name_;
@@ -1492,10 +1465,6 @@ inline void Popen::kill(int sig_num)
14921465
inline void Popen::execute_process() noexcept(false)
14931466
{
14941467
#ifdef __USING_WINDOWS__
1495-
if (this->shell_) {
1496-
throw OSError("shell not currently supported on windows", 0);
1497-
}
1498-
14991468
void* environment_string_table_ptr = nullptr;
15001469
env_vector_t environment_string_vector;
15011470
if(this->env_.size()){
@@ -1588,14 +1557,6 @@ inline void Popen::execute_process() noexcept(false)
15881557
int err_rd_pipe, err_wr_pipe;
15891558
std::tie(err_rd_pipe, err_wr_pipe) = util::pipe_cloexec();
15901559

1591-
if (shell_) {
1592-
auto new_cmd = util::join(vargs_);
1593-
vargs_.clear();
1594-
vargs_.insert(vargs_.begin(), {"/bin/sh", "-c"});
1595-
vargs_.push_back(new_cmd);
1596-
populate_c_argv();
1597-
}
1598-
15991560
if (exe_name_.length()) {
16001561
vargs_.insert(vargs_.begin(), exe_name_);
16011562
populate_c_argv();
@@ -1678,10 +1639,6 @@ namespace detail {
16781639
popen_->defer_process_start_ = defer.defer;
16791640
}
16801641

1681-
inline void ArgumentDeducer::set_option(shell&& sh) {
1682-
popen_->shell_ = sh.shell_;
1683-
}
1684-
16851642
inline void ArgumentDeducer::set_option(session_leader&& sleader) {
16861643
popen_->session_leader_ = sleader.leader_;
16871644
}

0 commit comments

Comments
 (0)