awesome.quit(): Add exit code argument (#1192)
Fixes: https://github.com/awesomeWM/awesome/issues/1184 Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
d0dc447dd5
commit
d71bb665d1
|
@ -490,6 +490,7 @@ main(int argc, char **argv)
|
||||||
p_clear(&globalconf, 1);
|
p_clear(&globalconf, 1);
|
||||||
globalconf.keygrabber = LUA_REFNIL;
|
globalconf.keygrabber = LUA_REFNIL;
|
||||||
globalconf.mousegrabber = LUA_REFNIL;
|
globalconf.mousegrabber = LUA_REFNIL;
|
||||||
|
globalconf.exit_code = EXIT_SUCCESS;
|
||||||
buffer_init(&globalconf.startup_errors);
|
buffer_init(&globalconf.startup_errors);
|
||||||
string_array_init(&searchpath);
|
string_array_init(&searchpath);
|
||||||
|
|
||||||
|
@ -754,7 +755,7 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
awesome_atexit(false);
|
awesome_atexit(false);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return globalconf.exit_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
||||||
|
|
|
@ -194,6 +194,8 @@ typedef struct
|
||||||
window_array_t destroy_later_windows;
|
window_array_t destroy_later_windows;
|
||||||
/** Pending event that still needs to be handled */
|
/** Pending event that still needs to be handled */
|
||||||
xcb_generic_event_t *pending_event;
|
xcb_generic_event_t *pending_event;
|
||||||
|
/** The exit code that main() will return with */
|
||||||
|
int exit_code;
|
||||||
} awesome_t;
|
} awesome_t;
|
||||||
|
|
||||||
extern awesome_t globalconf;
|
extern awesome_t globalconf;
|
||||||
|
|
3
luaa.c
3
luaa.c
|
@ -155,11 +155,14 @@ composite_manager_running(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Quit awesome.
|
/** Quit awesome.
|
||||||
|
* @tparam[opt=0] integer code The exit code to use when exiting.
|
||||||
* @function quit
|
* @function quit
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
luaA_quit(lua_State *L)
|
luaA_quit(lua_State *L)
|
||||||
{
|
{
|
||||||
|
if (!lua_isnoneornil(L, 1))
|
||||||
|
globalconf.exit_code = luaL_checkinteger(L, 1);
|
||||||
if (globalconf.loop == NULL)
|
if (globalconf.loop == NULL)
|
||||||
globalconf.loop = g_main_loop_new(NULL, FALSE);
|
globalconf.loop = g_main_loop_new(NULL, FALSE);
|
||||||
g_main_loop_quit(globalconf.loop);
|
g_main_loop_quit(globalconf.loop);
|
||||||
|
|
Loading…
Reference in New Issue