ProcessSettings.

StandardInput Property

Summary

Gets or sets the payload written to the process standard input.
Namespace
Cake.Core.IO
Containing Type
ProcessSettings

Syntax

public ProcessStandardInput? StandardInput { get; set; }

Examples

var fileName = Context.Tools.Resolve("dotnet.exe")
                ?? Context.Tools.Resolve("dotnet");
IEnumerable<string> redirectedStandardOutput;
var exitCode = StartProcess(
    fileName,
    new ProcessSettings {
        Arguments = "run -",
        StandardInput = 
            """
            Console.Write("Hello from stdin");
            """,
        RedirectStandardOutput = true
    },
    out redirectedStandardOutput);
Information("Output: {0}", string.Concat(redirectedStandardOutput));
Information("Exit code: {0}", exitCode);

Value

Type Description
ProcessStandardInput? The standard input payload. null leaves standard input unredirected. Accepts a string, a UTF-8 literal ("""..."""u8), a byte array, or ReadOnlyMemory<T> of byte.