blob: ed6644b44e42809be1ba823d8465ae0e6bfbdd59 [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
John Park33858a32018-09-28 23:05:48 -07006#include "aos/logging/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() {
Austin Schuhf257f3c2019-10-27 21:00:43 -070019 AOS_CHECK_EQ(atexit(TerminateExitHandler), 0);
Brian Silvermanf5f8d8e2015-12-06 18:39:12 -050020}
21
22} // namespace testing
23} // namespace aos