       @latex.package.status.view.status = 'building'
       @latex.package.status.view.update()
       @buildLogs = []
+      @buildErrs = []
       @execCmds = []
       @buildProcess()
 

    if atom.config.get('atom-latex.hide_log_if_success')
      @latex.panel.view.showLog = false
    @buildLogs.push ''
    @execCmds.push cmd
    # @latex.logPanel.showText icon: 'sync', spin: true, 'Building LaTeX.'
    @latex.logger.log.push({
      type: 'status',
      text: """Step #{@buildLogs.length}> #{cmd}"""
    })
    @process = @execCmd(
      cmd, {cwd: path.dirname @latex.mainFile}, (err, stdout, stderr) =>
        @process = undefined
        if !err or (err.code is null)
          @buildProcess()
        else
          @latex.panel.view.showLog = true
          @latex.logger.processError(
            """Failed Building LaTeX (code #{err.code}).""", err.message, true,
            [{
              text: "Dismiss"
              onDidClick: => @latex.logger.clearBuildError()
            }, {
              text: "Show build log"
              onDidClick: => @latex.logger.showLog()
            }]
          )
          @cmds = []
          # @latex.logPanel.showText icon: @latex.parser.status, 'Error.', 3000
          @latex.logger.log.push({
            type: 'status',
            text: 'Error occurred while building LaTeX.'
          })
          @latex.parser.parse @buildLogs?[@buildLogs?.length - 1]
    )

    @process.stdout.on 'data', (data) =>
      @buildLogs[@buildLogs.length - 1] += data

  postBuild: ->
    @latex.logger.clearBuildError()


  killProcess: ->
    @cmds = []
    if @currentProcess?
      @latex.logger.log.push({
        type: 'warning',
        text: "Killing running LaTeX command (PID: #{@currentProcess.pid})"
      })
      @currentProcess.kill()

  binCheck: (binary) ->
    if hb.sync binary
