diff options
| author | David Bremner <david@tethera.net> | 2022-06-04 08:11:19 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2022-06-18 08:24:46 -0300 |
| commit | bfcf9a6c102af9232b6d2e720f919ff1c9b431f8 (patch) | |
| tree | d84c71f598cbc496cbb21aba94322fac56c7becb /hooks.c | |
| parent | e167825bca476403b0371fbdf4c8fbdfb4a6f935 (diff) | |
CLI: set NOTMUCH_CONFIG in hooks.
This addresses a bug report / feature request of Uwe Kleine-König. The
assumption is that we always load a config file in the CLI (i.e. we
never pass "" as the config file argument to
notmuch_database_open_with_config).
[1]: id:8baa58c3-7ab9-ec03-1bbd-28aa5be838f2@kleine-koenig.org
Diffstat (limited to 'hooks.c')
| -rw-r--r-- | hooks.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -27,6 +27,7 @@ int notmuch_run_hook (notmuch_database_t *notmuch, const char *hook) { char *hook_path; + const char *config_path; int status = 0; pid_t pid; @@ -38,6 +39,12 @@ notmuch_run_hook (notmuch_database_t *notmuch, const char *hook) return 1; } + config_path = notmuch_config_path (notmuch); + if (setenv ("NOTMUCH_CONFIG", config_path, 1)) { + perror ("setenv"); + return 1; + } + /* Check access before fork() for speed and simplicity of error handling. */ if (access (hook_path, X_OK) == -1) { /* Ignore ENOENT. It's okay not to have a hook, hook dir, or even |
