Skip to content

Commit

Permalink
fix(command): check WIFEXITED
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexays committed Mar 30, 2020
1 parent ae3d4b9 commit ec451b5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/util/command.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ inline struct res exec(std::string cmd) {
if (!fp) return {-1, ""};
auto output = command::read(fp);
auto stat = command::close(fp, pid);
return {WEXITSTATUS(stat), output};
if (WIFEXITED(stat)) {
return {WEXITSTATUS(stat), output};
}
return {-1, output};
}

inline int32_t forkExec(std::string cmd) {
Expand Down

0 comments on commit ec451b5

Please sign in to comment.