From e6e14292ef376dbc0f8895eee3daf08f74ada895 Mon Sep 17 00:00:00 2001 From: Konstantin Osipov <kostja@tarantool.org> Date: Sun, 5 Apr 2015 22:48:11 +0300 Subject: [PATCH] gh-774: ctrl-c, ctrl-d should exit interactive mode Don't start event loop in interactive mode after it ends. --- src/lua/init.cc | 2 ++ src/lua/init.h | 1 + src/tarantool.cc | 1 - 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lua/init.cc b/src/lua/init.cc index aa1b11cc66..fc5619845a 100644 --- a/src/lua/init.cc +++ b/src/lua/init.cc @@ -67,6 +67,7 @@ struct lua_State *tarantool_L; * The fiber running the startup Lua script */ struct fiber *script_fiber; +bool start_loop = true; /* contents of src/lua/ files */ extern char uuid_lua[], @@ -427,6 +428,7 @@ run_script(va_list ap) lua_getfield(L, -1, "start"); lua_remove(L, -2); /* remove package.loaded.console */ lua_remove(L, -2); /* remove package.loaded */ + start_loop = false; } try { lua_checkstack(L, argc - 1); diff --git a/src/lua/init.h b/src/lua/init.h index 8e0489ea99..d779255195 100644 --- a/src/lua/init.h +++ b/src/lua/init.h @@ -34,6 +34,7 @@ struct lua_State; struct luaL_Reg; struct tbuf; +extern bool start_loop; /** * This is a callback used by tarantool_lua_init() to open diff --git a/src/tarantool.cc b/src/tarantool.cc index 9c302f2d6d..1fd1c634ac 100644 --- a/src/tarantool.cc +++ b/src/tarantool.cc @@ -75,7 +75,6 @@ int main_argc; /** Signals handled after start as part of the event loop. */ static ev_signal ev_sigs[4]; static const int ev_sig_count = sizeof(ev_sigs)/sizeof(*ev_sigs); -static bool start_loop = true; extern const void *opt_def; -- GitLab