blob: 8624c930cca91a1e211419e7c3b39e3f3aa03d0e [file] [log] [blame]
Brian Silvermanf5f8d8e2015-12-06 18:39:12 -05001#include "aos/testing/prevent_exit.h"
2
3#include <stdlib.h>
4#include <unistd.h>
5
Alex Perrycb7da4b2019-08-28 19:35:56 -07006#include "glog/logging.h"
Brian Silvermanf5f8d8e2015-12-06 18:39:12 -05007
8namespace aos {
9namespace testing {
10namespace {
11
12void TerminateExitHandler() {
13 _exit(EXIT_SUCCESS);
14}
15
16} // namespace
17
18void PreventExit() {
Alex Perrycb7da4b2019-08-28 19:35:56 -070019 CHECK_EQ(atexit(TerminateExitHandler), 0);
Brian Silvermanf5f8d8e2015-12-06 18:39:12 -050020}
21
22} // namespace testing
23} // namespace aos