From 17a28b58a4a6161cfba9814c3c764f42dbb292b5 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Fri, 12 Sep 2025 20:04:09 -0500 Subject: [PATCH] fix foreground unmount --- .../src/drives/fuse/fuse_base.cpp | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/repertory/librepertory/src/drives/fuse/fuse_base.cpp b/repertory/librepertory/src/drives/fuse/fuse_base.cpp index 71066e03..d972fdbd 100644 --- a/repertory/librepertory/src/drives/fuse/fuse_base.cpp +++ b/repertory/librepertory/src/drives/fuse/fuse_base.cpp @@ -178,6 +178,19 @@ void fuse_base::destroy_(void *ptr) { } void fuse_base::destroy_impl(void * /* ptr */) { + REPERTORY_USES_FUNCTION_NAME(); + +#if defined(__APPLE__) + if (not foreground_ && + not utils::remove_launchd_plist( + utils::path::combine("~", {"/Library/LaunchAgents"}), label_, + false)) { + utils::error::raise_error( + function_name, + fmt::format("failed to remove launchd entry|label|{}", label_)); + } +#endif // defined(__APPLE__) + if (not foreground_) { repertory::project_cleanup(); } @@ -451,6 +464,7 @@ auto fuse_base::mount([[maybe_unused]] std::vector orig_args, utils::plist_cfg cfg{}; cfg.args = orig_args; cfg.keep_alive = false; + cfg.keep_alive = false; cfg.label = label_; cfg.plist_path = utils::path::combine("~", {"/Library/LaunchAgents"}); cfg.run_at_load = false; @@ -939,13 +953,13 @@ auto fuse_base::unmount(const std::string &mount_location) -> int { REPERTORY_USES_FUNCTION_NAME(); #if defined(__APPLE__) - if (not utils::remove_launchd_plist( + if (not foreground_ && + not utils::remove_launchd_plist( utils::path::combine("~", {"/Library/LaunchAgents"}), label_, true)) { utils::error::raise_error( function_name, fmt::format("failed to remove launchd entry|label|{}", label_)); } - auto cmd = "umount \"" + mount_location + "\" >/dev/null 2>&1"; #else // !defined(__APPLE__) #if FUSE_USE_VERSION >= 30 @@ -956,6 +970,8 @@ auto fuse_base::unmount(const std::string &mount_location) -> int { #endif // defined(__APPLE__) return system(cmd.c_str()); +#if defined(__APPLE__) +#endif // defined(__APPLE__) } #if FUSE_USE_VERSION >= 30