aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2024-04-13 11:43:02 +0200
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2024-04-16 14:25:00 +0200
commit80d008c66d00d3496cd8549daee6775cf2c6b782 (patch)
tree0fe0c95a909c109ae09f396acd5140953f3a369a /src/util
parentcececad7b29e2ca3de1216db1c541dba6dc81bfa (diff)
downloadbitcoin-80d008c66d00d3496cd8549daee6775cf2c6b782.tar.xz
remove unneeded defer_spawn option from cpp-subprocess
For our use-case, there doesn't seem to be any need for this.
Diffstat (limited to 'src/util')
-rw-r--r--src/util/subprocess.hpp40
1 files changed, 3 insertions, 37 deletions
diff --git a/src/util/subprocess.hpp b/src/util/subprocess.hpp
index 1a98be3e1d..dd0789b72c 100644
--- a/src/util/subprocess.hpp
+++ b/src/util/subprocess.hpp
@@ -642,16 +642,6 @@ struct bufsize {
};
/*!
- * Option to defer spawning of the child process
- * till `Popen::start_process` API is called.
- * Default value is false.
- */
-struct defer_spawn {
- explicit defer_spawn(bool d): defer(d) {}
- bool defer = false;
-};
-
-/*!
* Option to close all file descriptors
* when the child process is spawned.
* The close fd list does not include
@@ -947,7 +937,6 @@ struct ArgumentDeducer
void set_option(cwd&& cwdir);
void set_option(bufsize&& bsiz);
void set_option(environment&& env);
- void set_option(defer_spawn&& defer);
void set_option(input&& inp);
void set_option(output&& out);
void set_option(error&& err);
@@ -1153,8 +1142,6 @@ private:
in case of redirection. See piping examples.
*12. error() - Get the error channel/File pointer. Usually used
in case of redirection.
- *13. start_process() - Start the child process. Only to be used when
- * `defer_spawn` option was provided in Popen constructor.
*/
class Popen
{
@@ -1172,7 +1159,7 @@ public:
// Setup the communication channels of the Popen class
stream_.setup_comm_channels();
- if (!defer_process_start_) execute_process();
+ execute_process();
}
template <typename... Args>
@@ -1184,7 +1171,7 @@ public:
// Setup the communication channels of the Popen class
stream_.setup_comm_channels();
- if (!defer_process_start_) execute_process();
+ execute_process();
}
template <typename... Args>
@@ -1195,7 +1182,7 @@ public:
// Setup the communication channels of the Popen class
stream_.setup_comm_channels();
- if (!defer_process_start_) execute_process();
+ execute_process();
}
/*
@@ -1207,8 +1194,6 @@ public:
}
*/
- void start_process() noexcept(false);
-
int pid() const noexcept { return child_pid_; }
int retcode() const noexcept { return retcode_; }
@@ -1282,7 +1267,6 @@ private:
std::future<void> cleanup_future_;
#endif
- bool defer_process_start_ = false;
bool close_fds_ = false;
bool session_leader_ = false;
@@ -1323,20 +1307,6 @@ inline void Popen::populate_c_argv()
cargv_.push_back(nullptr);
}
-inline void Popen::start_process() noexcept(false)
-{
- // The process was started/tried to be started
- // in the constructor itself.
- // For explicitly calling this API to start the
- // process, 'defer_spawn' argument must be set to
- // true in the constructor.
- if (!defer_process_start_) {
- assert (0);
- return;
- }
- execute_process();
-}
-
inline int Popen::wait() noexcept(false)
{
#ifdef __USING_WINDOWS__
@@ -1594,10 +1564,6 @@ namespace detail {
popen_->env_ = std::move(env.env_);
}
- inline void ArgumentDeducer::set_option(defer_spawn&& defer) {
- popen_->defer_process_start_ = defer.defer;
- }
-
inline void ArgumentDeducer::set_option(session_leader&& sleader) {
popen_->session_leader_ = sleader.leader_;
}