1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 20:01:15 +02:00

* Refactoring.

This commit is contained in:
Eelco Dolstra 2004-06-22 08:50:25 +00:00
parent 88fb4f6e53
commit c4cb6ea2bc
4 changed files with 25 additions and 20 deletions

View file

@ -491,3 +491,16 @@ Strings unpackStrings(const string & s)
return strings;
}
string statusToString(int status)
{
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
if (WIFEXITED(status))
return (format("failed with exit code %2%") % WEXITSTATUS(status)).str();
else if (WIFSIGNALED(status))
return (format("failed due to signal %2%") % WTERMSIG(status)).str();
else
return "died abnormally";
} else return "succeeded";
}