ghakit
    Preparing search index...

    Function exec

    • Executes a command as a child process, capturing both stdout and stderr.

      Both streams are collected and returned as strings instead of being passed to the current process.

      Parameters

      • command: string

        The command to execute.

      • args: string[]

        The arguments to pass to the command.

      • opts: ExecOptions & { stderr: "capture"; stdout: "capture" }

        Options with both stdout and stderr set to "capture".

      Returns Promise<{ stderr: string; stdout: string }>

      A promise that resolves to an object containing the captured stdout and stderr when the process exits successfully.

      An Error if the process fails to spawn, exits with a non-zero code, or is terminated by a signal.

    • Executes a command as a child process, capturing stdout.

      stdout is collected and returned as a string instead of being passed to the current process. stderr uses "inherit" mode by default, passing the output to the current process; set it to "silent" to suppress it, or "capture" to also collect it as a string (see the both-capture overload).

      Parameters

      • command: string

        The command to execute.

      • args: string[]

        The arguments to pass to the command.

      • opts: ExecOptions & { stdout: "capture" }

        Options with stdout set to "capture".

      Returns Promise<{ stdout: string }>

      A promise that resolves to an object containing the captured stdout when the process exits successfully.

      An Error if the process fails to spawn, exits with a non-zero code, or is terminated by a signal.

    • Executes a command as a child process, capturing stderr.

      stderr is collected and returned as a string instead of being passed to the current process. stdout uses "inherit" mode by default, passing the output to the current process; set it to "silent" to suppress it, or "capture" to also collect it as a string (see the both-capture overload).

      Parameters

      • command: string

        The command to execute.

      • args: string[]

        The arguments to pass to the command.

      • opts: ExecOptions & { stderr: "capture" }

        Options with stderr set to "capture".

      Returns Promise<{ stderr: string }>

      A promise that resolves to an object containing the captured stderr when the process exits successfully.

      An Error if the process fails to spawn, exits with a non-zero code, or is terminated by a signal.

    • Executes a command as a child process.

      By default, both stdout and stderr use "inherit" mode, passing the output to the current process. Set either to "silent" to suppress the output, or "capture" to collect and return it as a string (see the capture overloads).

      Parameters

      • command: string

        The command to execute.

      • args: string[]

        The arguments to pass to the command.

      • Optionalopts: ExecOptions

        Options for configuring the execution behavior.

      Returns Promise<void>

      A promise that resolves when the process exits successfully.

      An Error if the process fails to spawn, exits with a non-zero code, or is terminated by a signal.