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>
This commit is contained in:
Lukas Fleischer 2016-01-16 14:11:32 +01:00
parent 6ebcbd4d69
commit 2857bac971

View File

@ -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;
}