aboutsummaryrefslogtreecommitdiffstats
path: root/src/hooks.c
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright ranges for 2023Lukas Fleischer2023-04-111-1/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Update copyright ranges for 2022Lukas Fleischer2022-03-111-1/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Call setsid() for hook/notification commandsLukas Fleischer2021-04-041-1/+1
| | | | | | | | | We do not want hook or notification commands to interact with the terminal in any way. Create a new session for them. Addresses GitHub issue #326. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Redirect standard descriptors for hook/notify commandsLukas Fleischer2021-04-041-8/+5
| | | | | | | | | | | | | Disconnect stdin, stdout and stderr when running an external hook or notification command. The previous solution of appending "<&- >&- 2>&-" to the shell command line does not work if the command includes pipes. Use shell_exec() in notify_launch_cmd() instead of a custom (and incomplete) reimplementation of that command. Partially addresses GitHub issue #326. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Add parameter to redirect stderr to shell_exec()Lukas Fleischer2021-04-041-2/+2
| | | | | | | Add a function parameter to allows redirecting stderr in addition to stdin and stdout. The parameter will be used with a follow-up change. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix memory leak in run_hook()Lukas Fleischer2020-10-111-4/+5
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Run hooks quietlyLars Henriksen2020-07-261-15/+20
| | | | | | | | Hooks should not be run like external programs, but like load and save operations that do not take possession of the terminal. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Update copyright rangesLukas Fleischer2020-01-301-1/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix memory leak in run_hook()Lukas Fleischer2018-08-251-2/+4
| | | | | | Fixes GitHub issue #139. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Update copyright rangesLukas Fleischer2017-01-121-1/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* hooks.c: Fix window preparation in interactive modeLukas Fleischer2016-02-071-2/+3
| | | | | | | | | | | | | | In commit 2857bac (Fix segfault when running hooks in non-interactive mode, 2016-01-16), we added checks to fix a segmentation fault in non-interactive mode. However, at the same time, that commit broke window preparation in interactive mode. When wins_prepare_external() is called, the UI mode is changed to command line, such that we cannot determine whether we need to call wins_unprepare_external() when returning from the hook. As a workaround, we now store the mode in a temporary variable. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix segfault when running hooks in non-interactive modeLukas Fleischer2016-01-161-2/+6
| | | | | | | 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>
* Add pre-save and post-save hooksLukas Fleischer2016-01-071-0/+63
This adds support for hooks which are executed before/after saving calcurse data. Hooks can be placed under hooks/pre-save and hooks/post-save in the data directory and need to be executable. Potential use cases include: * Automatically commit any changes to the data files using a VCS. * Automatically sync with some sever component on data file changes. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>