MCPcopy Create free account
hub / github.com/apache/impala / GetExitStatus

Method GetExitStatus

be/src/kudu/util/subprocess.cc:685–723  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

683}
684
685Status Subprocess::GetExitStatus(int* exit_status, string* info_str) const {
686 if (state_ != kExited) {
687 const string err_str = "Sub-process termination hasn't yet been detected";
688 LOG(DFATAL) << err_str;
689 return Status::IllegalState(err_str);
690 }
691 string info;
692 int status;
693 if (WIFEXITED(wait_status_)) {
694 status = WEXITSTATUS(wait_status_);
695 if (status == 0) {
696 info = Substitute("$0: process successfully exited", program_);
697 } else {
698 info = Substitute("$0: process exited with non-zero status $1",
699 program_, status);
700 }
701 } else if (WIFSIGNALED(wait_status_)) {
702 // Using signal number as exit status.
703 status = WTERMSIG(wait_status_);
704 info = Substitute("$0: process exited on signal $1", program_, status);
705#if defined(WCOREDUMP)
706 if (WCOREDUMP(wait_status_)) {
707 SubstituteAndAppend(&info, " (core dumped)");
708 }
709#endif
710 } else {
711 status = -1;
712 info = Substitute("$0: process reported unexpected wait status $1",
713 program_, wait_status_);
714 LOG(DFATAL) << info;
715 }
716 if (exit_status) {
717 *exit_status = status;
718 }
719 if (info_str) {
720 *info_str = info;
721 }
722 return Status::OK();
723}
724
725Status Subprocess::Call(const string& arg_str) {
726 vector<string> argv = Split(arg_str, " ");

Callers 4

TEST_FFunction · 0.80
CallMethod · 0.80
HasProgramMethod · 0.80
RunStackDumpMethod · 0.80

Calls 4

IllegalStateFunction · 0.85
SubstituteFunction · 0.85
SubstituteAndAppendFunction · 0.85
OKFunction · 0.85

Tested by 1

TEST_FFunction · 0.64