@@ -656,18 +656,6 @@ struct executable: string_arg
656656 executable (T&& arg): string_arg(std::forward<T>(arg)) {}
657657};
658658
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-
671659/* !
672660 * Option to specify environment variables required by
673661 * the spawned process.
@@ -899,7 +887,6 @@ struct ArgumentDeducer
899887 ArgumentDeducer (Popen* p): popen_(p) {}
900888
901889 void set_option (executable&& exe);
902- void set_option (cwd&& cwdir);
903890 void set_option (environment&& env);
904891 void set_option (input&& inp);
905892 void set_option (output&& out);
@@ -1083,9 +1070,9 @@ class Streams
10831070 * interface to the client.
10841071 *
10851072 * API's provided by the class:
1086- * 1. Popen({"cmd"}, output{..}, error{..}, cwd{..}, ....)
1073+ * 1. Popen({"cmd"}, output{..}, error{..}, ....)
10871074 * Command provided as a sequence.
1088- * 2. Popen("cmd arg1"m output{..}, error{..}, cwd{..}, ....)
1075+ * 2. Popen("cmd arg1"m output{..}, error{..}, ....)
10891076 * Command provided in a single string.
10901077 * 3. wait() - Wait for the child to exit.
10911078 * 4. retcode() - The return code of the exited child.
@@ -1227,7 +1214,6 @@ class Popen
12271214#endif
12281215
12291216 std::string exe_name_;
1230- std::string cwd_;
12311217 env_map_t env_;
12321218
12331219 // Command in string format
@@ -1507,10 +1493,6 @@ namespace detail {
15071493 popen_->exe_name_ = std::move (exe.arg_value );
15081494 }
15091495
1510- inline void ArgumentDeducer::set_option (cwd&& cwdir) {
1511- popen_->cwd_ = std::move (cwdir.arg_value );
1512- }
1513-
15141496 inline void ArgumentDeducer::set_option (environment&& env) {
15151497 popen_->env_ = std::move (env.env_ );
15161498 }
@@ -1583,12 +1565,6 @@ namespace detail {
15831565 if (stream.err_write_ != -1 && stream.err_write_ > 2 )
15841566 close (stream.err_write_ );
15851567
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-
15921568 // Replace the current image with the executable
15931569 if (parent_->env_ .size ()) {
15941570 for (auto & kv : parent_->env_ ) {
0 commit comments