Skip to content

Commit 6f55435

Browse files
committed
Simplify pending finish logic, NFC
1 parent 694d93a commit 6f55435

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Sources/SwiftDriverExecution/MultiJobExecutor.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ class ExecuteJobRule: LLBuildRule {
504504
let env = context.env.merging(job.extraEnvironment, uniquingKeysWith: { $1 })
505505

506506
let value: DriverBuildValue
507-
var knownPId = Set<Int>()
507+
var pendingFinish = false
508508
var pid = 0
509509
do {
510510
let arguments: [String] = try resolver.resolveArgumentList(for: job,
@@ -525,8 +525,8 @@ class ExecuteJobRule: LLBuildRule {
525525
// Inform the delegate.
526526
context.delegateQueue.sync {
527527
context.executorDelegate.jobStarted(job: job, arguments: arguments, pid: pid)
528-
knownPId.insert(pid)
529528
}
529+
pendingFinish = true
530530

531531
let result = try process.waitUntilExit()
532532
let success = result.exitStatus == .terminated(code: EXIT_SUCCESS)
@@ -552,6 +552,7 @@ class ExecuteJobRule: LLBuildRule {
552552
context.delegateQueue.sync {
553553
context.executorDelegate.jobFinished(job: job, result: result, pid: pid)
554554
}
555+
pendingFinish = false
555556
context.cancelBuildIfNeeded(result)
556557
if !context.isBuildCancelled {
557558
try context.addRuleBeyondMandatoryCompiles(finishedJob: job, result: result)
@@ -563,7 +564,7 @@ class ExecuteJobRule: LLBuildRule {
563564
}
564565
// Only inform finished job if the job has been started, otherwise the build
565566
// system may complain about malformed output
566-
if (knownPId.contains(pid)) {
567+
if (pendingFinish) {
567568
context.delegateQueue.sync {
568569
let result = ProcessResult(
569570
arguments: [],

0 commit comments

Comments
 (0)