aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--src/jalv.c10
-rw-r--r--wscript6
3 files changed, 18 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index e8faa8f..237e932 100644
--- a/NEWS
+++ b/NEWS
@@ -4,10 +4,11 @@ jalv (1.6.1) unstable;
* Add jalv -i option to ignore stdin for background use
* Fix Jack deactivation
* Fix potential crash when closed with worker (thanks JP Cimalando)
+ * Fix potential hang after Ctrl-c in console interface (thanks Laxmi Devi)
* Add support for underscore in port names on command line
(thanks Jośe Fernando Moyano)
- -- David Robillard <d@drobilla.net> Thu, 20 Sep 2018 09:21:15 +0200
+ -- David Robillard <d@drobilla.net> Thu, 20 Sep 2018 09:27:15 +0200
jalv (1.6.0) stable;
diff --git a/src/jalv.c b/src/jalv.c
index b95e7d4..d25a8b2 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -878,8 +878,18 @@ main(int argc, char** argv)
zix_sem_init(&jalv.paused, 0);
zix_sem_init(&jalv.worker.sem, 0);
+#ifdef HAVE_SIGACTION
+ struct sigaction action;
+ sigemptyset(&action.sa_mask);
+ action.sa_flags = 0;
+ action.sa_handler = signal_handler;
+ sigaction(SIGINT, &action, NULL);
+ sigaction(SIGTERM, &action, NULL);
+#else
+ /* May not work in combination with fgets in the console interface */
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
+#endif
/* Find all installed plugins */
LilvWorld* world = lilv_world_new();
diff --git a/wscript b/wscript
index 622df5c..c84f891 100644
--- a/wscript
+++ b/wscript
@@ -120,6 +120,12 @@ def configure(conf):
define_name = 'HAVE_MLOCK',
mandatory = False)
+ autowaf.check_function(conf, 'c', 'sigaction',
+ header_name = 'signal.h',
+ defines = defines,
+ define_name = 'HAVE_SIGACTION',
+ mandatory = False)
+
if conf.is_defined('HAVE_ISATTY') and conf.is_defined('HAVE_FILENO'):
autowaf.define(conf, 'JALV_WITH_COLOR', 1)
conf.env.append_unique('CFLAGS', ['-D_POSIX_C_SOURCE=200809L'])