• Run a Shell on the OS with a command

    Type Parameters

    • Options extends {
          async?: boolean;
          timeout?: number;
      }

    Parameters

    • command: string
    • Optional options: Options

    Returns Options["async"] extends true
        ? Promise<string>
        : string

    Example

    import { system } from "@rjweb/utils"

    system.execute('echo hi', { async: false }) // 'hi\n'
    system.execute('wesgasg', { async: false }) // <throws Error>

    Throws

    If exit code is not 0

    Since

    1.3.0

    Supports

    nodejs