@@ -655,17 +655,6 @@ struct close_fds {
655
655
bool close_all = false ;
656
656
};
657
657
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
-
669
658
/* !
670
659
* Base class for all arguments involving string value.
671
660
*/
@@ -941,7 +930,6 @@ struct ArgumentDeducer
941
930
void set_option (output&& out);
942
931
void set_option (error&& err);
943
932
void set_option (close_fds&& cfds);
944
- void set_option (session_leader&& sleader);
945
933
946
934
private:
947
935
Popen* popen_ = nullptr ;
@@ -1268,7 +1256,6 @@ class Popen
1268
1256
#endif
1269
1257
1270
1258
bool close_fds_ = false ;
1271
- bool session_leader_ = false ;
1272
1259
1273
1260
std::string exe_name_;
1274
1261
std::string cwd_;
@@ -1385,8 +1372,7 @@ inline void Popen::kill(int sig_num)
1385
1372
throw OSError (" TerminateProcess" , 0 );
1386
1373
}
1387
1374
#else
1388
- if (session_leader_) killpg (child_pid_, sig_num);
1389
- else ::kill (child_pid_, sig_num);
1375
+ ::kill (child_pid_, sig_num);
1390
1376
#endif
1391
1377
}
1392
1378
@@ -1564,10 +1550,6 @@ namespace detail {
1564
1550
popen_->env_ = std::move (env.env_ );
1565
1551
}
1566
1552
1567
- inline void ArgumentDeducer::set_option (session_leader&& sleader) {
1568
- popen_->session_leader_ = sleader.leader_ ;
1569
- }
1570
-
1571
1553
inline void ArgumentDeducer::set_option (input&& inp) {
1572
1554
if (inp.rd_ch_ != -1 ) popen_->stream_ .read_from_parent_ = inp.rd_ch_ ;
1573
1555
if (inp.wr_ch_ != -1 ) popen_->stream_ .write_to_child_ = inp.wr_ch_ ;
@@ -1657,11 +1639,6 @@ namespace detail {
1657
1639
if (sys_ret == -1 ) throw OSError (" chdir failed" , errno);
1658
1640
}
1659
1641
1660
- if (parent_->session_leader_ ) {
1661
- sys_ret = setsid ();
1662
- if (sys_ret == -1 ) throw OSError (" setsid failed" , errno);
1663
- }
1664
-
1665
1642
// Replace the current image with the executable
1666
1643
if (parent_->env_ .size ()) {
1667
1644
for (auto & kv : parent_->env_ ) {
0 commit comments