Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Sources/Swiftly/Run.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,8 @@ struct Run: SwiftlyCommand {
}

mutating func run(_ ctx: SwiftlyCoreContext) async throws {
let versionUpdateReminder = try await validateSwiftly(ctx)
defer {
versionUpdateReminder()
}
try await validateSwiftly(ctx)

var config = try await Config.load(ctx)

// Handle the specific case where help is requested of the run subcommand
Expand Down
2 changes: 1 addition & 1 deletion Sources/Swiftly/SelfUpdate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct SelfUpdate: SwiftlyCommand {
}

mutating func run(_ ctx: SwiftlyCoreContext) async throws {
let _ = try await validateSwiftly(ctx)
try await validateSwiftly(ctx)

let swiftlyBin = Swiftly.currentPlatform.swiftlyBinDir(ctx) / "swiftly"
guard try await fs.exists(atPath: swiftlyBin) else {
Expand Down
1 change: 1 addition & 0 deletions Sources/Swiftly/Swiftly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ extension Data {
}

extension SwiftlyCommand {
@discardableResult
public mutating func validateSwiftly(_ ctx: SwiftlyCoreContext) async throws -> () -> Void {
for requiredDir in Swiftly.requiredDirectories(ctx) {
guard try await fs.exists(atPath: requiredDir) else {
Expand Down