fix foreground unmount
All checks were successful
BlockStorage/repertory_mac/pipeline/head This commit looks good
BlockStorage/repertory/pipeline/head This commit looks good

This commit is contained in:
2025-09-12 20:04:09 -05:00
parent 078f679cca
commit 17a28b58a4

View File

@@ -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<std::string> 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