From 2857bac97163ea43bf087e6350d44016fe1764b6 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sat, 16 Jan 2016 14:11:32 +0100 Subject: Fix segfault when running hooks in non-interactive mode Do not run wins_prepare_external() and wins_unprepare_external() before and after running hooks in non-interactive mode. Signed-off-by: Lukas Fleischer --- src/hooks.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/hooks.c') diff --git a/src/hooks.c b/src/hooks.c index 5fffb70..a2bc8b2 100644 --- a/src/hooks.c +++ b/src/hooks.c @@ -51,13 +51,17 @@ int run_hook(const char *name) if (!io_file_exists(hook_path)) return 0; - wins_prepare_external(); + if (ui_mode == UI_CURSES) + wins_prepare_external(); + if ((pid = shell_exec(NULL, NULL, *arg, arg))) { ret = child_wait(NULL, NULL, pid); if (ret) press_any_key(); } - wins_unprepare_external(); + + if (ui_mode == UI_CURSES) + wins_unprepare_external(); return ret; } -- cgit v1.2.3-54-g00ecf