aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2024-05-10 14:47:07 +0100
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2024-05-10 14:47:07 +0100
commit9e1ccf55e178144804e30cfe94757b6da2a6ca28 (patch)
tree6929adb3475b866c9577c7b560bc8927eaf8d98b /src/util
parent24b53fc84af301fff592e06723b980e29aa68289 (diff)
downloadbitcoin-9e1ccf55e178144804e30cfe94757b6da2a6ca28.tar.xz
refactor, subprocess: Remove unused `Popen::poll()`
Diffstat (limited to 'src/util')
-rw-r--r--src/util/subprocess.h53
1 files changed, 0 insertions, 53 deletions
diff --git a/src/util/subprocess.h b/src/util/subprocess.h
index 09b386a37a..37b77c1c56 100644
--- a/src/util/subprocess.h
+++ b/src/util/subprocess.h
@@ -902,7 +902,6 @@ private:
* Command provided in a single string.
* wait() - Wait for the child to exit.
* retcode() - The return code of the exited child.
- * poll() - Check the status of the running child.
* send(...) - Send input to the input channel of the child.
* communicate(...) - Get the output/error from the child and close the channels
* from the parent side.
@@ -959,8 +958,6 @@ public:
int wait() noexcept(false);
- int poll() noexcept(false);
-
void set_out_buf_cap(size_t cap) { stream_.set_out_buf_cap(cap); }
void set_err_buf_cap(size_t cap) { stream_.set_err_buf_cap(cap); }
@@ -1078,56 +1075,6 @@ inline int Popen::wait() noexcept(false)
#endif
}
-inline int Popen::poll() noexcept(false)
-{
-#ifdef __USING_WINDOWS__
- int ret = WaitForSingleObject(process_handle_, 0);
- if (ret != WAIT_OBJECT_0) return -1;
-
- DWORD dretcode_;
- if (FALSE == GetExitCodeProcess(process_handle_, &dretcode_))
- throw OSError("GetExitCodeProcess", 0);
-
- retcode_ = (int)dretcode_;
- CloseHandle(process_handle_);
-
- return retcode_;
-#else
- if (!child_created_) return -1; // TODO: ??
-
- int status;
-
- // Returns zero if child is still running
- int ret = waitpid(child_pid_, &status, WNOHANG);
- if (ret == 0) return -1;
-
- if (ret == child_pid_) {
- if (WIFSIGNALED(status)) {
- retcode_ = WTERMSIG(status);
- } else if (WIFEXITED(status)) {
- retcode_ = WEXITSTATUS(status);
- } else {
- retcode_ = 255;
- }
- return retcode_;
- }
-
- if (ret == -1) {
- // From subprocess.py
- // This happens if SIGCHLD is set to be ignored
- // or waiting for child process has otherwise been disabled
- // for our process. This child is dead, we cannot get the
- // status.
- if (errno == ECHILD) retcode_ = 0;
- else throw OSError("waitpid failed", errno);
- } else {
- retcode_ = ret;
- }
-
- return retcode_;
-#endif
-}
-
inline void Popen::execute_process() noexcept(false)
{
#ifdef __USING_WINDOWS__