mirror of
https://github.com/mhx/dwarfs.git
synced 2025-08-04 02:06:22 -04:00
chore(safe_main): work around Windows-specific issue in cpptrace
This commit is contained in:
parent
2983764d40
commit
843c75ae69
@ -52,6 +52,7 @@
|
|||||||
namespace dwarfs::tool {
|
namespace dwarfs::tool {
|
||||||
|
|
||||||
int safe_main(std::function<int(void)> const& fn) {
|
int safe_main(std::function<int(void)> const& fn) {
|
||||||
|
int retval{1};
|
||||||
DWARFS_TRY {
|
DWARFS_TRY {
|
||||||
install_signal_handlers();
|
install_signal_handlers();
|
||||||
setup_default_locale();
|
setup_default_locale();
|
||||||
@ -59,7 +60,7 @@ int safe_main(std::function<int(void)> const& fn) {
|
|||||||
::_set_abort_behavior(0, _WRITE_ABORT_MSG);
|
::_set_abort_behavior(0, _WRITE_ABORT_MSG);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return fn();
|
retval = fn();
|
||||||
}
|
}
|
||||||
DWARFS_CATCH(...) {
|
DWARFS_CATCH(...) {
|
||||||
std::cerr << "ERROR: " << exception_str(std::current_exception()) << "\n";
|
std::cerr << "ERROR: " << exception_str(std::current_exception()) << "\n";
|
||||||
@ -74,7 +75,7 @@ int safe_main(std::function<int(void)> const& fn) {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return 1;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace dwarfs::tool
|
} // namespace dwarfs::tool
|
||||||
|
Loading…
x
Reference in New Issue
Block a user