@@ -902,7 +902,6 @@ class Streams
902
902
* Command provided in a single string.
903
903
* wait() - Wait for the child to exit.
904
904
* retcode() - The return code of the exited child.
905
- * poll() - Check the status of the running child.
906
905
* send(...) - Send input to the input channel of the child.
907
906
* communicate(...) - Get the output/error from the child and close the channels
908
907
* from the parent side.
@@ -959,8 +958,6 @@ class Popen
959
958
960
959
int wait () noexcept (false );
961
960
962
- int poll () noexcept (false );
963
-
964
961
void set_out_buf_cap (size_t cap) { stream_.set_out_buf_cap (cap); }
965
962
966
963
void set_err_buf_cap (size_t cap) { stream_.set_err_buf_cap (cap); }
@@ -1078,56 +1075,6 @@ inline int Popen::wait() noexcept(false)
1078
1075
#endif
1079
1076
}
1080
1077
1081
- inline int Popen::poll () noexcept (false )
1082
- {
1083
- #ifdef __USING_WINDOWS__
1084
- int ret = WaitForSingleObject (process_handle_, 0 );
1085
- if (ret != WAIT_OBJECT_0) return -1 ;
1086
-
1087
- DWORD dretcode_;
1088
- if (FALSE == GetExitCodeProcess (process_handle_, &dretcode_))
1089
- throw OSError (" GetExitCodeProcess" , 0 );
1090
-
1091
- retcode_ = (int )dretcode_;
1092
- CloseHandle (process_handle_);
1093
-
1094
- return retcode_;
1095
- #else
1096
- if (!child_created_) return -1 ; // TODO: ??
1097
-
1098
- int status;
1099
-
1100
- // Returns zero if child is still running
1101
- int ret = waitpid (child_pid_, &status, WNOHANG);
1102
- if (ret == 0 ) return -1 ;
1103
-
1104
- if (ret == child_pid_) {
1105
- if (WIFSIGNALED (status)) {
1106
- retcode_ = WTERMSIG (status);
1107
- } else if (WIFEXITED (status)) {
1108
- retcode_ = WEXITSTATUS (status);
1109
- } else {
1110
- retcode_ = 255 ;
1111
- }
1112
- return retcode_;
1113
- }
1114
-
1115
- if (ret == -1 ) {
1116
- // From subprocess.py
1117
- // This happens if SIGCHLD is set to be ignored
1118
- // or waiting for child process has otherwise been disabled
1119
- // for our process. This child is dead, we cannot get the
1120
- // status.
1121
- if (errno == ECHILD) retcode_ = 0 ;
1122
- else throw OSError (" waitpid failed" , errno);
1123
- } else {
1124
- retcode_ = ret;
1125
- }
1126
-
1127
- return retcode_;
1128
- #endif
1129
- }
1130
-
1131
1078
inline void Popen::execute_process () noexcept (false )
1132
1079
{
1133
1080
#ifdef __USING_WINDOWS__
0 commit comments