 # startTime  - Number. Timestamp of a moment when compilation started.
 #
 # Returns Function.
-getCompileFn = (config, joinConfig, fileList, optimizers, watcher, callback) -> (startTime) ->
+getCompileFn = (config, joinConfig, fileList, optimizers, watcher, callback) -> (startTime, watcherReady) ->
   assetErrors = fileList.getAssetErrors()
   if assetErrors?
     assetErrors.forEach (error) -> logger.error error

        process.exit (if logger.errorHappened then 1 else previousCode)

    fileList.initial = false

    return if error?
    # Just pass `fs_utils.GeneratedFile` instances to callbacks.
    callback generatedFiles

  fs_utils.write fileList, config, joinConfig, optimizers, startTime, writeCb


        logger.error error
    else
      logger.info generateCompilationLog startTime, fileList.assets, generatedFiles, disposed
      # pass `fs_utils.GeneratedFile` instances to callbacks.
      callback generatedFiles

    return unless watcherReady

    # If it’s single non-continuous build, close file watcher and
    # exit process with correct exit code.
