edgeport - v1.0.6
    Preparing search index...

    Interface ExecResult

    The result of running a command to completion.

    interface ExecResult {
        code: number;
        stderr: Uint8Array;
        stderrText: string;
        stdout: Uint8Array;
        stdoutText: string;
        firstLine(): string;
        firstLines(n: number): string[];
        lastLine(): string;
        lastLines(n: number): string[];
        lineAt(index: number): string | undefined;
        lines(): string[];
    }
    Index
    code: number

    The command's exit status (0 on success).

    stderr: Uint8Array

    Raw standard-error bytes.

    stderrText: string

    stderr decoded as UTF-8. The raw bytes remain on stderr.

    1.0.4

    stdout: Uint8Array

    Raw standard-output bytes.

    stdoutText: string

    stdout decoded as UTF-8, for the common text-output case so callers do not build a TextDecoder themselves. The raw bytes remain on stdout.

    1.0.4

    • The first line of stdout, or '' if there was no output.

      Returns string

      The first line.

      1.0.4

    • The first n lines of stdout (fewer if there are fewer).

      Parameters

      • n: number

        How many leading lines to take.

      Returns string[]

      Up to n lines from the start.

      1.0.4

    • The last line of stdout, or '' if there was no output - handy for commands whose result is the final line (e.g. id -u, hostname).

      Returns string

      The last line.

      1.0.4

    • The last n lines of stdout (fewer if there are fewer).

      Parameters

      • n: number

        How many trailing lines to take.

      Returns string[]

      Up to n lines from the end.

      1.0.4

    • The stdout line at index (0-based; a negative index counts from the end, like Array.at), or undefined if out of range.

      Parameters

      • index: number

        The line index.

      Returns string | undefined

      The line, or undefined.

      1.0.4

    • Splits stdoutText into lines (a single trailing newline is dropped, so a clean one-line output yields exactly one entry). The basis for the line accessors below.

      Returns string[]

      The stdout lines.

      1.0.4