mirror of
https://github.com/NixOS/nix.git
synced 2025-11-26 12:10:59 +01:00
Merged R8632
This commit is contained in:
parent
3800f55b54
commit
8e9c7d9338
6 changed files with 53 additions and 8 deletions
|
|
@ -446,7 +446,11 @@ void warnOnce(bool & haveWarned, const format & f)
|
|||
|
||||
static void defaultWriteToStderr(const unsigned char * buf, size_t count)
|
||||
{
|
||||
writeFull(STDERR_FILENO, buf, count);
|
||||
try {
|
||||
writeFull(STDERR_FILENO, buf, count);
|
||||
} catch (SysError & e) {
|
||||
/* ignore EPIPE etc. */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -548,8 +552,8 @@ AutoCloseFD::~AutoCloseFD()
|
|||
{
|
||||
try {
|
||||
close();
|
||||
} catch (Error & e) {
|
||||
printMsg(lvlError, format("error (ignored): %1%") % e.msg());
|
||||
} catch (...) {
|
||||
ignoreException();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1046,6 +1050,15 @@ string unsignedInt2String(unsigned int n)
|
|||
return str.str();
|
||||
}
|
||||
|
||||
void ignoreException()
|
||||
{
|
||||
try {
|
||||
throw;
|
||||
} catch (std::exception & e) {
|
||||
printMsg(lvlError, format("error (ignored): %1%") % e.what());
|
||||
}
|
||||
}
|
||||
|
||||
bool string2UnsignedInt(const string & s, unsigned int & n)
|
||||
{
|
||||
std::istringstream str(s);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue