RAGS - v1.10.0
    Preparing search index...

    Variable exec

    exec: {
        <Out = string, Err = string>(args: Args<Out, Err>): Out | Err;
        <Out = string, Err = string>(
            cmd: string | string[],
            out?: (stdout: string) => Out,
            err?: (stderr: string) => Err,
        ): Out | Err;
    }

    Type Declaration

      • <Out = string, Err = string>(args: Args<Out, Err>): Out | Err
      • Executes a command synchronously and returns the result.

        Blocks the main loop until the command completes. Use execAsync for non-blocking execution.

        Type Parameters

        • Out = string
        • Err = string

        Parameters

        Returns Out | Err

        The transformed stdout on success, or transformed stderr on failure

        const user = exec('whoami');
        const parsed = exec('cat config.json', JSON.parse);
      • <Out = string, Err = string>(
            cmd: string | string[],
            out?: (stdout: string) => Out,
            err?: (stderr: string) => Err,
        ): Out | Err
      • Executes a command synchronously and returns the result.

        Blocks the main loop until the command completes. Use execAsync for non-blocking execution.

        Type Parameters

        • Out = string
        • Err = string

        Parameters

        • cmd: string | string[]
        • Optionalout: (stdout: string) => Out
        • Optionalerr: (stderr: string) => Err

        Returns Out | Err

        The transformed stdout on success, or transformed stderr on failure

        const user = exec('whoami');
        const parsed = exec('cat config.json', JSON.parse);