From d2ed4ef80166dbdc41a0db160f38fa1f42ec9e0d Mon Sep 17 00:00:00 2001 From: Fedor Korotkov Date: Fri, 7 Jul 2023 03:38:31 -0400 Subject: [PATCH] Resume suspended VMs without explicit `--suspendable` flag (#540) --- Sources/tart/Commands/Run.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/tart/Commands/Run.swift b/Sources/tart/Commands/Run.swift index 3f5e6db..4f3f5bf 100644 --- a/Sources/tart/Commands/Run.swift +++ b/Sources/tart/Commands/Run.swift @@ -108,6 +108,12 @@ struct Run: AsyncParsableCommand { if graphics && noGraphics { throw ValidationError("--graphics and --no-graphics are mutually exclusive") } + + let localStorage = VMStorageLocal() + let vmDir = try localStorage.open(name) + if try vmDir.state() == "suspended" { + suspendable = true + } } @MainActor