aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib_os.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/lib_os.c b/src/lib_os.c
index 690bffe8..a62fd3b4 100644
--- a/src/lib_os.c
+++ b/src/lib_os.c
@@ -92,8 +92,15 @@ LJLIB_CF(os_getenv)
92 92
93LJLIB_CF(os_exit) 93LJLIB_CF(os_exit)
94{ 94{
95 exit(lj_lib_optint(L, 1, EXIT_SUCCESS)); 95 int status;
96 return 0; /* to avoid warnings */ 96 if (L->base < L->top && tvisbool(L->base))
97 status = boolV(L->base) ? EXIT_SUCCESS : EXIT_FAILURE;
98 else
99 status = lj_lib_optint(L, 1, EXIT_SUCCESS);
100 if (L->base+1 < L->top && tvistruecond(L->base+1))
101 lua_close(L);
102 exit(status);
103 return 0; /* Unreachable. */
97} 104}
98 105
99LJLIB_CF(os_clock) 106LJLIB_CF(os_clock)