Skip to content

API 参考 / @142vip/utils / VipExecutor

变量: VipExecutor ​

const VipExecutor: object

定义于: packages/utils/src/core/exec.ts:221

执行器

类型声明 ​

commandStandardExecutor() ​

commandStandardExecutor: (cmd) => Promise<StandardExecutorResponse>

标准Linux命令执行器

  • 支持打印结果
  • 异步

参数 ​

cmd ​

Command

返回 ​

Promise<StandardExecutorResponse>

execCommand() ​

execCommand: (cmd, opts?) => Promise<CommandResponse>

异步执行命令,并返回结果

参数 ​

cmd ​

Command

opts? ​

Omit<SpawnOptionsWithoutStdio, "stdio" | "cwd">

返回 ​

Promise<CommandResponse>

execCommandSync() ​

execCommandSync: (cmd, cwd?) => string

参数 ​

cmd ​

string

cwd? ​

string

返回 ​

string

execShell() ​

execShell: (commands) => Promise<void>

脚本执行器,执行shell命令

参数 ​

commands ​

string | ShellCommand | ShellCommand[]

返回 ​

Promise<void>

getCommandTrimResponse() ​

getCommandTrimResponse: (command) => Promise<null | string>

获取命令执行的trim操作后的结果

参数 ​

command ​

string

返回 ​

Promise<null | string>