       // Only inform finished job if the job has been started, otherwise the build
       // system may complain about malformed output
       if (knownPId.contains(pid)) {
-        context.delegateQueue.async {
+        context.delegateQueue.sync {
           let result = ProcessResult(
             arguments: [],
             environment: env,

      }

      // Inform the delegate.
      context.delegateQueue.async {
        context.executorDelegate.jobStarted(job: job, arguments: arguments, pid: pid)
        knownPId.insert(pid)
      }

      }

      // Inform the delegate about job finishing.
      context.delegateQueue.sync {
        context.executorDelegate.jobFinished(job: job, result: result, pid: pid)
      }
      context.cancelBuildIfNeeded(result)
