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);
|
||||
globalconf.keygrabber = LUA_REFNIL;
|
||||
globalconf.mousegrabber = LUA_REFNIL;
|
||||
globalconf.exit_code = EXIT_SUCCESS;
|
||||
buffer_init(&globalconf.startup_errors);
|
||||
string_array_init(&searchpath);
|
||||
|
||||
|
@ -754,7 +755,7 @@ main(int argc, char **argv)
|
|||
|
||||
awesome_atexit(false);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
return globalconf.exit_code;
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
||||
|
|
|
@ -194,6 +194,8 @@ typedef struct
|
|||
window_array_t destroy_later_windows;
|
||||
/** Pending event that still needs to be handled */
|
||||
xcb_generic_event_t *pending_event;
|
||||
/** The exit code that main() will return with */
|
||||
int exit_code;
|
||||
} awesome_t;
|
||||
|
||||
extern awesome_t globalconf;
|
||||
|
|
3
luaa.c
3
luaa.c
|
@ -155,11 +155,14 @@ composite_manager_running(void)
|
|||
}
|
||||
|
||||
/** Quit awesome.
|
||||
* @tparam[opt=0] integer code The exit code to use when exiting.
|
||||
* @function quit
|
||||
*/
|
||||
static int
|
||||
luaA_quit(lua_State *L)
|
||||
{
|
||||
if (!lua_isnoneornil(L, 1))
|
||||
globalconf.exit_code = luaL_checkinteger(L, 1);
|
||||
if (globalconf.loop == NULL)
|
||||
globalconf.loop = g_main_loop_new(NULL, FALSE);
|
||||
g_main_loop_quit(globalconf.loop);
|
||||
|
|
Loading…
Reference in New Issue