fix(command): check WIFEXITED
This commit is contained in:
parent
ae3d4b9d28
commit
ec451b5908
|
@ -72,8 +72,11 @@ inline struct res exec(std::string cmd) {
|
|||
if (!fp) return {-1, ""};
|
||||
auto output = command::read(fp);
|
||||
auto stat = command::close(fp, pid);
|
||||
if (WIFEXITED(stat)) {
|
||||
return {WEXITSTATUS(stat), output};
|
||||
}
|
||||
return {-1, output};
|
||||
}
|
||||
|
||||
inline int32_t forkExec(std::string cmd) {
|
||||
if (cmd == "") return -1;
|
||||
|
|
Loading…
Reference in New Issue