UNPKG

@shopify/cli-kit

Version:

A set of utilities, interfaces, and models that are common across all the platform features

66 lines (65 loc) 2.26 kB
import { AbortSignal } from './abort.js'; import type { Writable, Readable } from 'stream'; export interface ExecOptions { cwd?: string; env?: { [key: string]: string | undefined; }; stdin?: Readable | 'inherit'; stdout?: Writable | 'inherit'; stderr?: Writable | 'inherit'; stdio?: 'inherit'; input?: string; signal?: AbortSignal; externalErrorHandler?: (error: unknown) => Promise<void>; background?: boolean; } /** * Opens a URL in the user's default browser. * * @param url - URL to open. * @returns A promise that resolves true if the URL was opened successfully, false otherwise. */ export declare function openURL(url: string): Promise<boolean>; /** * Runs a command asynchronously, aggregates the stdout data, and returns it. * * @param command - Command to be executed. * @param args - Arguments to pass to the command. * @param options - Optional settings for how to run the command. * @returns A promise that resolves with the aggregatted stdout of the command. */ export declare function captureOutput(command: string, args: string[], options?: ExecOptions): Promise<string>; /** * Runs a command asynchronously. * * @param command - Command to be executed. * @param args - Arguments to pass to the command. * @param options - Optional settings for how to run the command. */ export declare function exec(command: string, args: string[], options?: ExecOptions): Promise<void>; /** * Waits for a given number of seconds. * * @param seconds - Number of seconds to wait. * @returns A Promise resolving after the number of seconds. */ export declare function sleep(seconds: number): Promise<void>; /** * Check if the standard input and output streams support prompting. * * @returns True if the standard input and output streams support prompting. */ export declare function terminalSupportsPrompting(): boolean; /** * Check if the current environment is a CI environment. * * @returns True if the current environment is a CI environment. */ export declare function isCI(): boolean; /** * Check if the current environment is a WSL environment. * * @returns True if the current environment is a WSL environment. */ export declare function isWsl(): Promise<boolean>;