diff options
Diffstat (limited to 'Sluift/main.cpp')
-rw-r--r-- | Sluift/main.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Sluift/main.cpp b/Sluift/main.cpp index 76ba572..505cc5c 100644 --- a/Sluift/main.cpp +++ b/Sluift/main.cpp @@ -1,4 +1,4 @@ /* - * Copyright (c) 2013 Remko Tronçon + * Copyright (c) 2013-2014 Remko Tronçon * Licensed under the GNU General Public License. * See the COPYING file for more information. @@ -16,4 +16,5 @@ #include <boost/numeric/conversion/cast.hpp> #include <boost/assign/list_of.hpp> +#include <Sluift/globals.h> #include <Sluift/Console.h> #include <Sluift/StandardTerminal.h> @@ -49,4 +50,8 @@ static const luaL_Reg defaultLibraries[] = { }; +static void handleInterruptSignal(int) { + Sluift::globals.interruptRequested = 1; +} + static void checkResult(lua_State* L, int result) { if (result && !lua_isnil(L, -1)) { @@ -151,4 +156,7 @@ int main(int argc, char* argv[]) { // Run console if (arguments.count("interactive") || arguments.count("script") == 0) { + // Set up signal handler + signal(SIGINT, handleInterruptSignal); + // Import some useful functions into the global namespace lua_getglobal(L, "sluift"); |