redirect: use unmount force instead of eject

Reviewed By: mshroyer

Differential Revision: D43578518

fbshipit-source-id: 0e34b10bcc5651a4d41f5b7f63c2f4b1cf444258
This commit is contained in:
Michael Cuevas 2023-02-24 15:36:42 -08:00 committed by Facebook GitHub Bot
parent 7b32c8fbe7
commit b36645215e
2 changed files with 6 additions and 9 deletions

View File

@ -313,11 +313,9 @@ class Redirection:
def _bind_unmount_darwin(self, checkout: EdenCheckout) -> None:
mount_path = checkout.path / self.repo_path
# This will unmount/detach both disk images and apfs volumes.
# `diskutil eject` fully removes the image from the list of disk
# partitions while `diskutil unmount` leaves leftover state for some
# reason. We will use `eject` since they're essentially the same.
run_cmd_quietly(["diskutil", "eject", mount_path])
# We use unmount instead of eject here since eject has caused issues
# by unmounting unrelated apfs volumes in the past. See S325232.
run_cmd_quietly(["diskutil", "unmount", "force", mount_path])
def _bind_mount_linux(
self, instance: EdenInstance, checkout_path: Path, target: Path

View File

@ -641,10 +641,9 @@ impl Redirection {
#[cfg(target_os = "macos")]
fn _bind_unmount_darwin(&self, checkout: &EdenFsCheckout) -> Result<()> {
let mount_path = checkout.path().join(&self.repo_path);
// `diskutil eject` fully removes the image from the list of disk partitions while
// `diskutil unmount` leaves leftover state for some reason. We will use `eject` since
// they're essentially the same.
let args = &["eject", &mount_path.to_string_lossy()];
// We use unmount instead of eject here since eject has caused issues
// by unmounting unrelated apfs volumes in the past. See S325232.
let args = &["unmount", "force", &mount_path.to_string_lossy()];
let output = Command::new("diskutil")
.args(args)
.output()