Fix watcher breakage on failed builds (#347)

After switching to `async`/`await` the value of `isBuildCurrentlyRunning` wasn't correctly reset, which led to issues. By resetting the variable in `defer` we guarantee that it will be reset even when errors are thrown.

Resolves #339.
This commit is contained in:
Max Desiatov 2022-05-20 14:03:34 +01:00 committed by GitHub
parent c834751074
commit 53bc06c23d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -201,6 +201,8 @@ public actor Server {
}
isBuildCurrentlyRunning = true
defer { isBuildCurrentlyRunning = false }
// `configuration.builder` is guaranteed to be non-nil here as its presence is checked in `init`
try await run(configuration.builder!, configuration.terminal)
@ -213,7 +215,6 @@ public actor Server {
}
isSubsequentBuildScheduled = false
isBuildCurrentlyRunning = false
}
private func add(pendingChanges: [AbsolutePath]) {}

View File

@ -7,3 +7,4 @@ DerivedData/
.swiftpm/config/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
.vscode