blob: b640fe716e99b7dc6cd9068cf317732a96c41303 [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
9namespace aos {
10namespace testing {
11namespace {
12
Tyler Chatowbf0609c2021-07-31 16:13:27 -070013void TerminateExitHandler() { _exit(EXIT_SUCCESS); }
Brian Silvermanf5f8d8e2015-12-06 18:39:12 -050014
15} // namespace
16
Tyler Chatowbf0609c2021-07-31 16:13:27 -070017void PreventExit() { CHECK_EQ(atexit(TerminateExitHandler), 0); }
Brian Silvermanf5f8d8e2015-12-06 18:39:12 -050018
19} // namespace testing
20} // namespace aos