Skip to content

Commit

Permalink
fix update failures
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Keller committed Mar 3, 2017
1 parent e78b28a commit 0e53580
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Sources/update.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ func launchProcess(path: String, arguments: [String]) -> Process {
#endif
}

var isUpdating = false

func installUpdate() -> Bool {
do {
#if os(Linux)
Expand Down Expand Up @@ -102,6 +104,10 @@ public func getVersionLink(_ version: String) -> String {


func prepareUpdate(_ listener: ChatListener, _ rooms: [ChatRoom], isAuto: Bool = false) -> Bool {
if isUpdating {
return true
}

do {
try downloadUpdate(isAuto: isAuto)
} catch DownloadFailure.noAutoupdate {
Expand All @@ -111,6 +117,7 @@ func prepareUpdate(_ listener: ChatListener, _ rooms: [ChatRoom], isAuto: Bool =
return false
}

isUpdating = true
rooms.forEach {$0.postMessage("Installing update...")}
listener.stop(.update)
return true
Expand Down

0 comments on commit 0e53580

Please sign in to comment.