<commit_before>package cook.app.subcommand

import cook.actors._
import cook.app.console.CookConsole
import cook.util._

object Run extends SubCommand("run", "Run target") {

  override def run(args: Array[String]): Int = {
    if (args.isEmpty) {
      CookConsole.println("no target to run")
      help
      return 1
    }
    if (args.size > 1) {
      CookConsole.println("can only run one target at a time")
      help
      return 1
    }

    // TODO(timgreen): move to better place
    val currentDir = FileUtil.relativeDirToRoot(System.getProperty("user.dir"))
    val targetLabel = new TargetLabel(currentDir, args(0))

    Builder.build(Seq(targetLabel))
    Runner.run(targetLabel)

    0
  }

  def help() {
    CookConsole.println("usage: cook run <target>")
  }
}<commit_msg>Run command exit when build error<commit_after>package cook.app.subcommand

import cook.actors._
import cook.app.console.CookConsole
import cook.util._

object Run extends SubCommand("run", "Run target") {

  override def run(args: Array[String]): Int = {
    if (args.isEmpty) {
      CookConsole.println("no target to run")
      help
      return 1
    }
    if (args.size > 1) {
      CookConsole.println("can only run one target at a time")
      help
      return 1
    }

    // TODO(timgreen): move to better place
    val currentDir = FileUtil.relativeDirToRoot(System.getProperty("user.dir"))
    val targetLabel = new TargetLabel(currentDir, args(0))

    val buildExitCode = Builder.build(Seq(targetLabel))
    if (buildExitCode != 0) {
      return buildExitCode
    }
    Runner.run(targetLabel)

    0
  }

  def help() {
    CookConsole.println("usage: cook run <target>")
  }
}
{'fraction_non_alphanumeric': 0.11335311572700296, 'fraction_numerical': 0.006528189910979229, 'mean_word_length': 3.023866348448687, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5088271', 'n_tokens_mistral': 534, 'n_tokens_neox': 511, 'n_words': 140}