mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 18:20:58 +02:00
remove unneeded session_leader option from cpp-subprocess
This commit is contained in:
@ -655,17 +655,6 @@ struct close_fds {
|
|||||||
bool close_all = false;
|
bool close_all = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
|
||||||
* Option to make the child process as the
|
|
||||||
* session leader and thus the process
|
|
||||||
* group leader.
|
|
||||||
* Default value is false.
|
|
||||||
*/
|
|
||||||
struct session_leader {
|
|
||||||
explicit session_leader(bool sl): leader_(sl) {}
|
|
||||||
bool leader_ = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Base class for all arguments involving string value.
|
* Base class for all arguments involving string value.
|
||||||
*/
|
*/
|
||||||
@ -941,7 +930,6 @@ struct ArgumentDeducer
|
|||||||
void set_option(output&& out);
|
void set_option(output&& out);
|
||||||
void set_option(error&& err);
|
void set_option(error&& err);
|
||||||
void set_option(close_fds&& cfds);
|
void set_option(close_fds&& cfds);
|
||||||
void set_option(session_leader&& sleader);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Popen* popen_ = nullptr;
|
Popen* popen_ = nullptr;
|
||||||
@ -1268,7 +1256,6 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool close_fds_ = false;
|
bool close_fds_ = false;
|
||||||
bool session_leader_ = false;
|
|
||||||
|
|
||||||
std::string exe_name_;
|
std::string exe_name_;
|
||||||
std::string cwd_;
|
std::string cwd_;
|
||||||
@ -1385,8 +1372,7 @@ inline void Popen::kill(int sig_num)
|
|||||||
throw OSError("TerminateProcess", 0);
|
throw OSError("TerminateProcess", 0);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (session_leader_) killpg(child_pid_, sig_num);
|
::kill(child_pid_, sig_num);
|
||||||
else ::kill(child_pid_, sig_num);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1564,10 +1550,6 @@ namespace detail {
|
|||||||
popen_->env_ = std::move(env.env_);
|
popen_->env_ = std::move(env.env_);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ArgumentDeducer::set_option(session_leader&& sleader) {
|
|
||||||
popen_->session_leader_ = sleader.leader_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void ArgumentDeducer::set_option(input&& inp) {
|
inline void ArgumentDeducer::set_option(input&& inp) {
|
||||||
if (inp.rd_ch_ != -1) popen_->stream_.read_from_parent_ = inp.rd_ch_;
|
if (inp.rd_ch_ != -1) popen_->stream_.read_from_parent_ = inp.rd_ch_;
|
||||||
if (inp.wr_ch_ != -1) popen_->stream_.write_to_child_ = inp.wr_ch_;
|
if (inp.wr_ch_ != -1) popen_->stream_.write_to_child_ = inp.wr_ch_;
|
||||||
@ -1657,11 +1639,6 @@ namespace detail {
|
|||||||
if (sys_ret == -1) throw OSError("chdir failed", errno);
|
if (sys_ret == -1) throw OSError("chdir failed", errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent_->session_leader_) {
|
|
||||||
sys_ret = setsid();
|
|
||||||
if (sys_ret == -1) throw OSError("setsid failed", errno);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Replace the current image with the executable
|
// Replace the current image with the executable
|
||||||
if (parent_->env_.size()) {
|
if (parent_->env_.size()) {
|
||||||
for (auto& kv : parent_->env_) {
|
for (auto& kv : parent_->env_) {
|
||||||
|
Reference in New Issue
Block a user