<commit_before>package jetbrains.buildServer.nuget.agent.util.impl

import jetbrains.buildServer.agent.BuildFinishedStatus
import jetbrains.buildServer.agent.BuildProgressLogger
import jetbrains.buildServer.agent.BuildRunnerContext
import jetbrains.buildServer.agent.runner.*

/**
 * Executes command line and logs output.
 */
class CommandLineBuildSession(private val myCommandLine: ProgramCommandLine,
                              private val myHostContext: BuildRunnerContext)
    : ProcessListenerAdapter(), MultiCommandBuildSession, CommandExecution {
    private var myExecuted: Boolean = false
    private var myExitCode: Int = 0

    override fun sessionStarted() {}

    override fun getNextCommand(): CommandExecution? {
        if (!myExecuted) {
            myExecuted = true
            return this
        }
        return null
    }

    override fun makeProgramCommandLine() = myCommandLine

    override fun beforeProcessStarted() {}

    override fun onStandardOutput(text: String) {
        if (text.startsWith("WARNING")) {
            buildLogger.warning(text)
        } else {
            buildLogger.message(text)
        }
    }

    override fun onErrorOutput(text: String) {
        buildLogger.error(text)
    }

    override fun processFinished(exitCode: Int) {
        myExitCode = exitCode
    }

    override fun sessionFinished(): BuildFinishedStatus? {
        return if (myExitCode == 0) BuildFinishedStatus.FINISHED_SUCCESS else BuildFinishedStatus.FINISHED_FAILED
    }

    override fun interruptRequested(): TerminationAction {
        return TerminationAction.KILL_PROCESS_TREE
    }

    override fun isCommandLineLoggingEnabled(): Boolean {
        return true
    }

    private val buildLogger: BuildProgressLogger by lazy {
        myHostContext.build.buildLogger
    }
}<commit_msg>Don't log empty lines from NuGet stderr<commit_after>package jetbrains.buildServer.nuget.agent.util.impl

import jetbrains.buildServer.agent.BuildFinishedStatus
import jetbrains.buildServer.agent.BuildProgressLogger
import jetbrains.buildServer.agent.BuildRunnerContext
import jetbrains.buildServer.agent.runner.*

/**
 * Executes command line and logs output.
 */
class CommandLineBuildSession(private val myCommandLine: ProgramCommandLine,
                              private val myHostContext: BuildRunnerContext)
    : ProcessListenerAdapter(), MultiCommandBuildSession, CommandExecution {
    private var myExecuted: Boolean = false
    private var myExitCode: Int = 0

    override fun sessionStarted() {}

    override fun getNextCommand(): CommandExecution? {
        if (!myExecuted) {
            myExecuted = true
            return this
        }
        return null
    }

    override fun makeProgramCommandLine() = myCommandLine

    override fun beforeProcessStarted() {}

    override fun onStandardOutput(text: String) {
        if (text.startsWith("WARNING")) {
            buildLogger.warning(text)
        } else {
            buildLogger.message(text)
        }
    }

    override fun onErrorOutput(text: String) {
        if (text.isNotBlank()) {
            buildLogger.error(text)
        }
    }

    override fun processFinished(exitCode: Int) {
        myExitCode = exitCode
    }

    override fun sessionFinished(): BuildFinishedStatus? {
        return if (myExitCode == 0) BuildFinishedStatus.FINISHED_SUCCESS else BuildFinishedStatus.FINISHED_FAILED
    }

    override fun interruptRequested(): TerminationAction {
        return TerminationAction.KILL_PROCESS_TREE
    }

    override fun isCommandLineLoggingEnabled(): Boolean {
        return true
    }

    private val buildLogger: BuildProgressLogger by lazy {
        myHostContext.build.buildLogger
    }
}
{'fraction_non_alphanumeric': 0.07294180745508179, 'fraction_numerical': 0.0010726736390453205, 'mean_word_length': 2.985042735042735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7063607', 'n_tokens_mistral': 986, 'n_tokens_neox': 949, 'n_words': 228}