/// import { ChildProcess as NativeChildProcess, SpawnOptions } from "child_process"; /** * 执行一个命令 * @param command 要执行的命令 * @param options 附加选项 * @param options.args 启动命令时的附加参数 * @param options.timeout 执行超时毫秒数,设置 0 表示不超时 * @returns 返回子进程 */ export declare function exec(command: string, options?: SpawnOptions & { args?: readonly string[]; timeout?: number; }): ChildProcess; /** 表示一个子进程 */ export interface ChildProcess extends NativeChildProcess, PromiseLike { /** 获取进程的执行结果 */ result: ExecResult; } /** 表示执行命令的结果 */ export interface ExecResult { /** 获取执行的错误 */ error?: Error; /** 获取命令的退出码 */ exitCode?: number; /** 获取命令的标准流输出 */ stdout?: string; /** 获取命令的错误流输出 */ stderr?: string; } /** * 在浏览器打开指定的地址 * @param url 要打开的地址 * @param wait 是否等待浏览器启动后再返回 * @param app 使用的浏览器程序,默认由操作系统决定 * @param appArgs 浏览器程序的附加启动参数 */ export declare function open(url: string, wait?: boolean, app?: string, appArgs?: readonly string[]): Promise; /** * 添加当前程序即将退出的回调函数 * @param callback 要执行的回调函数,函数可以返回 `Promise` 表示正在执行异步任务,但在通过主动调用 `process.exit()` 退出进程时,`Promise` 会被忽略 */ export declare function onExit(callback: (reason: "exit" | (ReturnType extends IterableIterator ? T : never), code: number) => void): void; /** * 删除当前程序即将退出的回调函数 * @param callback 要执行的回调函数 */ export declare function offExit(callback: Parameters[0]): void; /** * 获取所有退出信号名 * @see https://github.com/tapjs/signal-exit/blob/master/signals.js */ declare function signals(): Generator<"SIGABRT" | "SIGALRM" | "SIGHUP" | "SIGINT" | "SIGIO" | "SIGIOT" | "SIGPOLL" | "SIGPWR" | "SIGQUIT" | "SIGSTKFLT" | "SIGSYS" | "SIGTERM" | "SIGTRAP" | "SIGUNUSED" | "SIGUSR2" | "SIGVTALRM" | "SIGXCPU" | "SIGXFSZ", void, unknown>; export {};