NoOpOutputHandler

A mocking implementation of a command output handler.

This is intended to be used only in mocking tests of a CmdLang in a CmdBuilder that involve trivial output handling. This should not be used when using the CmdLang as a utilities, where CmdLang.outputHandler should be overridden as null, to allow for runtime checks of outputHandler if accidentally used.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
protected val graderLogPath: Path

Root directory path where arbitrary grader output files from stage execution are stored under as logs.

Functions

Link copied to clipboard
open override fun collectOutput(onSuccess: (Path) -> Unit, onFailure: (Path) -> Unit)

IO action to perform after stage execution (under an environment like a container), in order to load stage output files from the file system for reading and further reporting. This method shall put the contents of output files into a readable internal state representing the outputs.

Link copied to clipboard
open override fun getResultContent(result: CmdUtils.Var.Result<*>): List<String>

Retrieves the stored content for result after stage execution. This method should utilize the outputs state to derive and return the content.

Link copied to clipboard
open fun onAfterCore(): List<String>

Commands to execute after any core commands.

Link copied to clipboard

Commands to execute after any core commands and onAfterCore commands.

Link copied to clipboard
open fun onBeforeCore(): List<String>

Commands to execute before any core commands.

Link copied to clipboard
open operator fun String.rangeTo(rest: String): String

Command building combinator to concat different parts of the command with proper spacing.

Link copied to clipboard
open override fun CmdUtils.Var.register(cmd: String): String

Register a Var to record the results of cmd for constructing reports after stage execution.

Link copied to clipboard
open fun setup()

Setup actions required to take before container execution for this output handler to run successfully. For example: delete all files at mount mount, create directories at mount point.