summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2016-01-16 14:11:32 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2016-01-16 14:11:32 +0100
commit2857bac97163ea43bf087e6350d44016fe1764b6 (patch)
treeaa15b0c408ba846c99b6b63780380a6bf7afd572 /src
parent6ebcbd4d69a90e9d100220e4e5dea6e88f202a6d (diff)
downloadcalcurse-2857bac97163ea43bf087e6350d44016fe1764b6.tar.gz
calcurse-2857bac97163ea43bf087e6350d44016fe1764b6.zip
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 <lfleischer@calcurse.org>
Diffstat (limited to 'src')
-rw-r--r--src/hooks.c8
1 files changed, 6 insertions, 2 deletions
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;
}