From 70f9fcc12e811ef6e2ff173c2dfcfca547467d12 Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Wed, 23 Nov 2022 07:37:48 +0400 Subject: [PATCH] tart run: do not check --disk lock for read-only attachments (#334) --- Sources/tart/Commands/Run.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/tart/Commands/Run.swift b/Sources/tart/Commands/Run.swift index fa7a277..7f421ee 100644 --- a/Sources/tart/Commands/Run.swift +++ b/Sources/tart/Commands/Run.swift @@ -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")