Skip to content

Commit

Permalink
Fixed bug with eject/unmount on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
IngvarX committed Mar 23, 2021
1 parent 51f78bc commit fab506c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/Camelot.Services.Mac/MacMountedDriveService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -33,7 +33,7 @@ public override Task EjectAsync(string driveRootDirectory)
var arguments = string.Format(EjectDriveArguments, driveRootDirectory);

_processService.Run(EjectDriveCommand, arguments);

return Task.CompletedTask;
}
}
Expand Down
12 changes: 6 additions & 6 deletions tests/Camelot.Services.Mac.Tests/MacMountedDriveServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit fab506c

Please sign in to comment.