diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2022-08-18 21:40:52 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-08-18 21:35:32 -0700 |
commit | ec4c23116b2d1bb34b3952c0597032ca8ed6e5fc (patch) | |
tree | 25c1cefea2081ebe4170cb247a7f4455bb67cdc0 | |
parent | 3f1917dc608021d7e94f4aaed9ecc9f58f9e32a4 (diff) |
scalar unregister: stop FSMonitor daemon
Especially on Windows, we will need to stop that daemon, just in case
that the directory needs to be removed (the daemon would otherwise hold
a handle to that directory, preventing it from being deleted).
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | contrib/scalar/scalar.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/contrib/scalar/scalar.c b/contrib/scalar/scalar.c index 73cd5b1fd0..07c3f7dd6b 100644 --- a/contrib/scalar/scalar.c +++ b/contrib/scalar/scalar.c @@ -244,6 +244,16 @@ static int start_fsmonitor_daemon(void) return 0; } +static int stop_fsmonitor_daemon(void) +{ + assert(have_fsmonitor_support()); + + if (fsmonitor_ipc__get_state() == IPC_STATE__LISTENING) + return run_git("fsmonitor--daemon", "stop", NULL); + + return 0; +} + static int register_dir(void) { if (add_or_remove_enlistment(1)) @@ -468,6 +478,9 @@ static int delete_enlistment(struct strbuf *enlistment) strbuf_release(&parent); #endif + if (have_fsmonitor_support() && stop_fsmonitor_daemon()) + return error(_("failed to stop the FSMonitor daemon")); + if (remove_dir_recursively(enlistment, 0)) return error(_("failed to delete enlistment directory")); |