From fab506cece770da545792332bbc6dcf05386071a Mon Sep 17 00:00:00 2001 From: IngvarX Date: Tue, 23 Mar 2021 19:27:18 +0300 Subject: [PATCH] Fixed bug with eject/unmount on mac --- src/Camelot.Services.Mac/MacMountedDriveService.cs | 6 +++--- .../MacMountedDriveServiceTests.cs | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Camelot.Services.Mac/MacMountedDriveService.cs b/src/Camelot.Services.Mac/MacMountedDriveService.cs index c6f75fba..f6a1cd8e 100644 --- a/src/Camelot.Services.Mac/MacMountedDriveService.cs +++ b/src/Camelot.Services.Mac/MacMountedDriveService.cs @@ -7,9 +7,9 @@ namespace Camelot.Services.Mac public class MacMountedDriveService : MountedDriveServiceBase { private const string UnmountDriveCommand = "diskutil"; - private const string UnmountDriveArguments = "unmount {0}"; + private const string UnmountDriveArguments = "unmount \"{0}\""; private const string EjectDriveCommand = "diskutil"; - private const string EjectDriveArguments = "eject {0}"; + private const string EjectDriveArguments = "eject \"{0}\""; private readonly IProcessService _processService; @@ -33,7 +33,7 @@ public override Task EjectAsync(string driveRootDirectory) var arguments = string.Format(EjectDriveArguments, driveRootDirectory); _processService.Run(EjectDriveCommand, arguments); - + return Task.CompletedTask; } } diff --git a/tests/Camelot.Services.Mac.Tests/MacMountedDriveServiceTests.cs b/tests/Camelot.Services.Mac.Tests/MacMountedDriveServiceTests.cs index 025a6769..9aafdfba 100644 --- a/tests/Camelot.Services.Mac.Tests/MacMountedDriveServiceTests.cs +++ b/tests/Camelot.Services.Mac.Tests/MacMountedDriveServiceTests.cs @@ -19,9 +19,9 @@ public MacMountedDriveServiceTests() } [Theory] - [InlineData("/home/test", "diskutil", "unmount /home/test")] - [InlineData("/home/camelot", "diskutil", "unmount /home/camelot")] - [InlineData("/dev/disk1", "diskutil", "unmount /dev/disk1")] + [InlineData("/home/test", "diskutil", "unmount \"/home/test\"")] + [InlineData("/home/camelot", "diskutil", "unmount \"/home/camelot\"")] + [InlineData("/dev/disk1", "diskutil", "unmount \"/dev/disk1\"")] public void TestUnmount(string drive, string command, string arguments) { _autoMocker @@ -39,9 +39,9 @@ public void TestUnmount(string drive, string command, string arguments) } [Theory] - [InlineData("/home/test", "diskutil", "eject /home/test")] - [InlineData("/home/camelot", "diskutil", "eject /home/camelot")] - [InlineData("/dev/disk1", "diskutil", "eject /dev/disk1")] + [InlineData("/home/test", "diskutil", "eject \"/home/test\"")] + [InlineData("/home/camelot", "diskutil", "eject \"/home/camelot\"")] + [InlineData("/dev/disk1", "diskutil", "eject \"/dev/disk1\"")] public async Task TestEject(string drive, string command, string arguments) { _autoMocker