MCPcopy Create free account
hub / github.com/arun11299/cpp-subprocess / wait_for_child_exit

Function wait_for_child_exit

cpp-subprocess/subprocess.hpp:760–773  ·  view source on GitHub ↗

! * Function: wait_for_child_exit * Waits for the process with pid `pid` to exit * and returns its status. * Parameters: * [in] pid : The pid of the process. * [out] pair : * pair.first : Return code of the waitpid call. * pair.second : Exit status of the process. * * NOTE: This is a blocking call as in, it will loop * till the child is exited.

Source from the content-addressed store, hash-verified

758 * till the child is exited.
759 */
760 static inline
761 std::pair<int, int> wait_for_child_exit(int pid)
762 {
763 int status = 0;
764 int ret = -1;
765 while (1) {
766 ret = waitpid(pid, &status, 0);
767 if (ret == -1) break;
768 if (ret == 0) continue;
769 return std::make_pair(ret, status);
770 }
771
772 return std::make_pair(ret, status);
773 }
774#endif
775
776} // end namespace util

Callers 1

waitMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected