tart run: do not check --disk lock for read-only attachments (#334)

This commit is contained in:
Nikolay Edigaryev 2022-11-23 07:37:48 +04:00 committed by GitHub
parent 456ebc1c7b
commit 70f9fcc12e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -110,6 +110,11 @@ struct Run: AsyncParsableCommand {
// Error out if the disk is locked by the host (e.g. it was mounted in Finder),
// see https://github.com/cirruslabs/tart/issues/323 for more details.
for additionalDiskAttachment in additionalDiskAttachments {
// Read-only attachments do not seem to acquire the lock
if additionalDiskAttachment.isReadOnly {
continue
}
if try !FileLock(lockURL: additionalDiskAttachment.url).trylock() {
print("disk \(additionalDiskAttachment.url.path) seems to be already in use, "
+ "unmount it first in Finder")