fix foreground unmount
This commit is contained in:
@@ -178,6 +178,19 @@ void fuse_base::destroy_(void *ptr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void fuse_base::destroy_impl(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_) {
|
if (not foreground_) {
|
||||||
repertory::project_cleanup();
|
repertory::project_cleanup();
|
||||||
}
|
}
|
||||||
@@ -451,6 +464,7 @@ auto fuse_base::mount([[maybe_unused]] std::vector<std::string> orig_args,
|
|||||||
utils::plist_cfg cfg{};
|
utils::plist_cfg cfg{};
|
||||||
cfg.args = orig_args;
|
cfg.args = orig_args;
|
||||||
cfg.keep_alive = false;
|
cfg.keep_alive = false;
|
||||||
|
cfg.keep_alive = false;
|
||||||
cfg.label = label_;
|
cfg.label = label_;
|
||||||
cfg.plist_path = utils::path::combine("~", {"/Library/LaunchAgents"});
|
cfg.plist_path = utils::path::combine("~", {"/Library/LaunchAgents"});
|
||||||
cfg.run_at_load = false;
|
cfg.run_at_load = false;
|
||||||
@@ -939,13 +953,13 @@ auto fuse_base::unmount(const std::string &mount_location) -> int {
|
|||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#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::path::combine("~", {"/Library/LaunchAgents"}), label_, true)) {
|
||||||
utils::error::raise_error(
|
utils::error::raise_error(
|
||||||
function_name,
|
function_name,
|
||||||
fmt::format("failed to remove launchd entry|label|{}", label_));
|
fmt::format("failed to remove launchd entry|label|{}", label_));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto cmd = "umount \"" + mount_location + "\" >/dev/null 2>&1";
|
auto cmd = "umount \"" + mount_location + "\" >/dev/null 2>&1";
|
||||||
#else // !defined(__APPLE__)
|
#else // !defined(__APPLE__)
|
||||||
#if FUSE_USE_VERSION >= 30
|
#if FUSE_USE_VERSION >= 30
|
||||||
@@ -956,6 +970,8 @@ auto fuse_base::unmount(const std::string &mount_location) -> int {
|
|||||||
#endif // defined(__APPLE__)
|
#endif // defined(__APPLE__)
|
||||||
|
|
||||||
return system(cmd.c_str());
|
return system(cmd.c_str());
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#endif // defined(__APPLE__)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FUSE_USE_VERSION >= 30
|
#if FUSE_USE_VERSION >= 30
|
||||||
|
Reference in New Issue
Block a user