@@ -656,18 +656,6 @@ struct executable: string_arg
656
656
executable (T&& arg): string_arg(std::forward<T>(arg)) {}
657
657
};
658
658
659
- /* !
660
- * Option to set the current working directory
661
- * of the spawned process.
662
- *
663
- * Eg: cwd{"/some/path/x"}
664
- */
665
- struct cwd : string_arg
666
- {
667
- template <typename T>
668
- cwd (T&& arg): string_arg(std::forward<T>(arg)) {}
669
- };
670
-
671
659
/* !
672
660
* Option to specify environment variables required by
673
661
* the spawned process.
@@ -899,7 +887,6 @@ struct ArgumentDeducer
899
887
ArgumentDeducer (Popen* p): popen_(p) {}
900
888
901
889
void set_option (executable&& exe);
902
- void set_option (cwd&& cwdir);
903
890
void set_option (environment&& env);
904
891
void set_option (input&& inp);
905
892
void set_option (output&& out);
@@ -1083,9 +1070,9 @@ class Streams
1083
1070
* interface to the client.
1084
1071
*
1085
1072
* API's provided by the class:
1086
- * 1. Popen({"cmd"}, output{..}, error{..}, cwd{..}, ....)
1073
+ * 1. Popen({"cmd"}, output{..}, error{..}, ....)
1087
1074
* Command provided as a sequence.
1088
- * 2. Popen("cmd arg1"m output{..}, error{..}, cwd{..}, ....)
1075
+ * 2. Popen("cmd arg1"m output{..}, error{..}, ....)
1089
1076
* Command provided in a single string.
1090
1077
* 3. wait() - Wait for the child to exit.
1091
1078
* 4. retcode() - The return code of the exited child.
@@ -1227,7 +1214,6 @@ class Popen
1227
1214
#endif
1228
1215
1229
1216
std::string exe_name_;
1230
- std::string cwd_;
1231
1217
env_map_t env_;
1232
1218
1233
1219
// Command in string format
@@ -1507,10 +1493,6 @@ namespace detail {
1507
1493
popen_->exe_name_ = std::move (exe.arg_value );
1508
1494
}
1509
1495
1510
- inline void ArgumentDeducer::set_option (cwd&& cwdir) {
1511
- popen_->cwd_ = std::move (cwdir.arg_value );
1512
- }
1513
-
1514
1496
inline void ArgumentDeducer::set_option (environment&& env) {
1515
1497
popen_->env_ = std::move (env.env_ );
1516
1498
}
@@ -1583,12 +1565,6 @@ namespace detail {
1583
1565
if (stream.err_write_ != -1 && stream.err_write_ > 2 )
1584
1566
close (stream.err_write_ );
1585
1567
1586
- // Change the working directory if provided
1587
- if (parent_->cwd_ .length ()) {
1588
- sys_ret = chdir (parent_->cwd_ .c_str ());
1589
- if (sys_ret == -1 ) throw OSError (" chdir failed" , errno);
1590
- }
1591
-
1592
1568
// Replace the current image with the executable
1593
1569
if (parent_->env_ .size ()) {
1594
1570
for (auto & kv : parent_->env_ ) {
0 commit comments