<commit_before>package de.tototec.sbuild.addons.support

import java.io.InputStream
import java.io.OutputStream
import java.io.File
import de.tototec.sbuild.Project
import de.tototec.sbuild.Path
import de.tototec.sbuild.LogLevel

/**
 * Provided various support functions for forking of processes.
 */
object ForkSupport {

  /**
   * Run the system default JVM with the given classpath and arguments.
   *
   * @param classpath The classpath used by the JVM.
   * @param arguments The arguments to the JVM. The first parameter should be the Java class containing a `main` method.
   * @param interactive If `true`, the input stream is routed to the newly started process, to read user input.
   *
   *  @return The return value of the Java process. Typically 0 indicated success whereas any other value is treated as error.
   */
  def runJavaAndWait(classpath: Seq[File], arguments: Array[String], interactive: Boolean = false)(implicit project: Project): Int = {

    val java = "java"

    val cpArgs = classpath match {
      case null | Seq() => Array[String]()
      case cp => Array("-cp", pathAsArg(classpath))
    }

    runAndWait(
      command = Array(java) ++ cpArgs ++ arguments,
      interactive = interactive)
  }
<commit_msg>Formatted.<commit_after>package de.tototec.sbuild.addons.support

import java.io.InputStream
import java.io.OutputStream
import java.io.File
import de.tototec.sbuild.Project
import de.tototec.sbuild.Path
import de.tototec.sbuild.LogLevel

/**
 * Provided various support functions for forking of processes.
 */
object ForkSupport {

  /**
   * Run the system default JVM with the given classpath and arguments.
   *
   * @param classpath The classpath used by the JVM.
   * @param arguments The arguments to the JVM. The first parameter should be the Java class containing a `main` method.
   * @param interactive If `true`, the input stream is routed to the newly started process, to read user input.
   *
   * @return The return value of the Java process. Typically 0 indicated success whereas any other value is treated as error.
   */
  def runJavaAndWait(classpath: Seq[File], arguments: Array[String], interactive: Boolean = false)(implicit project: Project): Int = {

    val java = "java"

    val cpArgs = classpath match {
      case null | Seq() => Array[String]()
      case cp => Array("-cp", pathAsArg(classpath))
    }

    runAndWait(
      command = Array(java) ++ cpArgs ++ arguments,
      interactive = interactive)
  }

{'fraction_non_alphanumeric': 0.09219001610305957, 'fraction_numerical': 0.0008051529790660225, 'mean_word_length': 3.5596330275229358, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2566419', 'n_tokens_mistral': 713, 'n_tokens_neox': 694, 'n_words': 266}