From 25cfec3760e1839eaff1877af4410e1e4b58df75 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 8 Sep 2016 22:09:45 +0200 Subject: [PATCH] Pass Ctrl+C on to child process when running panda3d from cmd-line --- direct/src/plugin/p3dInstanceManager.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/direct/src/plugin/p3dInstanceManager.cxx b/direct/src/plugin/p3dInstanceManager.cxx index fa8c70def2..7e67aeb945 100644 --- a/direct/src/plugin/p3dInstanceManager.cxx +++ b/direct/src/plugin/p3dInstanceManager.cxx @@ -1528,6 +1528,17 @@ create_runtime_environment() { } } +#ifndef _WIN32 + // If we're running from the console, make sure that terminating the parent + // process will cause the child process to terminate as well. + if (_console_environment) { + struct sigaction ignore; + memset(&ignore, 0, sizeof(ignore)); + ignore.sa_handler = SIG_IGN; + sigaction(SIGINT, &ignore, NULL); + } +#endif + _created_runtime_environment = true; }