1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

nix-build, nix-shell: Don't print error message if nix-store/nix-instantiate fails

This commit is contained in:
Eelco Dolstra 2016-09-21 16:21:47 +02:00
parent c55bf085eb
commit 4546be1b3e
3 changed files with 39 additions and 6 deletions

View file

@ -927,7 +927,7 @@ string runProgram(Path program, bool searchPath, const Strings & args,
/* Wait for the child to finish. */
int status = pid.wait(true);
if (!statusOk(status))
throw ExecError(format("program %1% %2%")
throw ExecError(status, format("program %1% %2%")
% program % statusToString(status));
return result;

View file

@ -247,7 +247,16 @@ pid_t startProcess(std::function<void()> fun, const ProcessOptions & options = P
string runProgram(Path program, bool searchPath = false,
const Strings & args = Strings(), const string & input = "");
MakeError(ExecError, Error)
class ExecError : public Error
{
public:
int status;
template<typename... Args>
ExecError(int status, Args... args)
: Error(args...), status(status)
{ }
};
/* Convert a list of strings to a null-terminated vector of char
*'s. The result must not be accessed beyond the lifetime of the