blob: 7c8da606277dba83ac0e1dc2cfff3c4b05353154 [file] [log] [blame]
Brian Silvermanf5f8d8e2015-12-06 18:39:12 -05001#include "aos/testing/prevent_exit.h"
2
Brian Silvermanf5f8d8e2015-12-06 18:39:12 -05003#include <unistd.h>
4
Tyler Chatowbf0609c2021-07-31 16:13:27 -07005#include <cstdlib>
6
Alex Perrycb7da4b2019-08-28 19:35:56 -07007#include "glog/logging.h"
Brian Silvermanf5f8d8e2015-12-06 18:39:12 -05008
Stephan Pleinesf63bde82024-01-13 15:59:33 -08009namespace aos::testing {
Brian Silvermanf5f8d8e2015-12-06 18:39:12 -050010namespace {
11
Tyler Chatowbf0609c2021-07-31 16:13:27 -070012void TerminateExitHandler() { _exit(EXIT_SUCCESS); }
Brian Silvermanf5f8d8e2015-12-06 18:39:12 -050013
14} // namespace
15
Tyler Chatowbf0609c2021-07-31 16:13:27 -070016void PreventExit() { CHECK_EQ(atexit(TerminateExitHandler), 0); }
Brian Silvermanf5f8d8e2015-12-06 18:39:12 -050017
Stephan Pleinesf63bde82024-01-13 15:59:33 -080018} // namespace aos::testing