* Put WEXITSTATUS stuff somewhere else.
This commit is contained in:
parent
84007a0958
commit
5e2cf44a4d
4 changed files with 11 additions and 3 deletions
|
@ -501,7 +501,7 @@ void NormalisationGoal::buildDone()
|
|||
debug(format("builder process for `%1%' finished") % nePath);
|
||||
|
||||
/* Check the exit status. */
|
||||
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
|
||||
if (!statusOk(status)) {
|
||||
deleteTmpDir(false);
|
||||
throw Error(format("builder for `%1%' %2%")
|
||||
% nePath % statusToString(status));
|
||||
|
@ -1371,7 +1371,7 @@ void SubstitutionGoal::finished()
|
|||
debug(format("substitute for `%1%' finished") % storePath);
|
||||
|
||||
/* Check the exit status. */
|
||||
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
|
||||
if (!statusOk(status))
|
||||
throw Error(format("builder for `%1%' %2%")
|
||||
% storePath % statusToString(status));
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ void copyPath(const Path & src, const Path & dst)
|
|||
|
||||
/* Wait for the child to finish. */
|
||||
int status = pid.wait(true);
|
||||
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
|
||||
if (!statusOk(status))
|
||||
throw Error(format("cannot copy `%1% to `%2%': child %3%")
|
||||
% src % dst % statusToString(status));
|
||||
}
|
||||
|
|
|
@ -611,3 +611,9 @@ string statusToString(int status)
|
|||
return "died abnormally";
|
||||
} else return "succeeded";
|
||||
}
|
||||
|
||||
|
||||
bool statusOk(int status)
|
||||
{
|
||||
return WIFEXITED(status) && WEXITSTATUS(status) == 0;
|
||||
}
|
||||
|
|
|
@ -243,5 +243,7 @@ Strings unpackStrings(const string & s);
|
|||
error string. */
|
||||
string statusToString(int status);
|
||||
|
||||
bool statusOk(int status);
|
||||
|
||||
|
||||
#endif /* !__UTIL_H */
|
||||
|
|
Loading…
Reference in a new issue