diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-04-16 20:58:19 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2020-04-16 20:58:19 +0300 |
commit | ec0813e4e66172bff73f09772257a580723575bd (patch) | |
tree | 3e02bd52ad4d41aefb5baa7b24d490621e8d5ed6 | |
parent | c1f396592c5942222fb5446207ab56e8714420e8 (diff) |
Fix crashing on unhandled io_error thrown by depdb::flush()
-rw-r--r-- | libbuild2/depdb.ixx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libbuild2/depdb.ixx b/libbuild2/depdb.ixx index 92afa32..819fadd 100644 --- a/libbuild2/depdb.ixx +++ b/libbuild2/depdb.ixx @@ -1,6 +1,8 @@ // file : libbuild2/depdb.ixx -*- C++ -*- // license : MIT; see accompanying LICENSE file +#include <libbuild2/diagnostics.hxx> + namespace build2 { inline depdb_base:: @@ -16,7 +18,14 @@ namespace build2 flush () { if (state_ == state::write) + try + { os_.flush (); + } + catch (const io_error& e) + { + fail << "unable to flush " << path << ": " << e; + } } inline bool depdb:: |