Skip to content

Commit 62db8f8

Browse files
committed
remove unneeded session_leader option from cpp-subprocess
1 parent 80d008c commit 62db8f8

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

src/util/subprocess.hpp

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -655,17 +655,6 @@ struct close_fds {
655655
bool close_all = false;
656656
};
657657

658-
/*!
659-
* Option to make the child process as the
660-
* session leader and thus the process
661-
* group leader.
662-
* Default value is false.
663-
*/
664-
struct session_leader {
665-
explicit session_leader(bool sl): leader_(sl) {}
666-
bool leader_ = false;
667-
};
668-
669658
/*!
670659
* Base class for all arguments involving string value.
671660
*/
@@ -941,7 +930,6 @@ struct ArgumentDeducer
941930
void set_option(output&& out);
942931
void set_option(error&& err);
943932
void set_option(close_fds&& cfds);
944-
void set_option(session_leader&& sleader);
945933

946934
private:
947935
Popen* popen_ = nullptr;
@@ -1268,7 +1256,6 @@ class Popen
12681256
#endif
12691257

12701258
bool close_fds_ = false;
1271-
bool session_leader_ = false;
12721259

12731260
std::string exe_name_;
12741261
std::string cwd_;
@@ -1385,8 +1372,7 @@ inline void Popen::kill(int sig_num)
13851372
throw OSError("TerminateProcess", 0);
13861373
}
13871374
#else
1388-
if (session_leader_) killpg(child_pid_, sig_num);
1389-
else ::kill(child_pid_, sig_num);
1375+
::kill(child_pid_, sig_num);
13901376
#endif
13911377
}
13921378

@@ -1564,10 +1550,6 @@ namespace detail {
15641550
popen_->env_ = std::move(env.env_);
15651551
}
15661552

1567-
inline void ArgumentDeducer::set_option(session_leader&& sleader) {
1568-
popen_->session_leader_ = sleader.leader_;
1569-
}
1570-
15711553
inline void ArgumentDeducer::set_option(input&& inp) {
15721554
if (inp.rd_ch_ != -1) popen_->stream_.read_from_parent_ = inp.rd_ch_;
15731555
if (inp.wr_ch_ != -1) popen_->stream_.write_to_child_ = inp.wr_ch_;
@@ -1657,11 +1639,6 @@ namespace detail {
16571639
if (sys_ret == -1) throw OSError("chdir failed", errno);
16581640
}
16591641

1660-
if (parent_->session_leader_) {
1661-
sys_ret = setsid();
1662-
if (sys_ret == -1) throw OSError("setsid failed", errno);
1663-
}
1664-
16651642
// Replace the current image with the executable
16661643
if (parent_->env_.size()) {
16671644
for (auto& kv : parent_->env_) {

0 commit comments

Comments
 (0)