接口: ExecStreamOptions
目录
Since
0.2.2
属性
onOutput
• Optional onOutput: (data: { stdout: string ; stderr?: undefined } | { stdout?: undefined ; stderr: string }) => void
类型声明
▸ (data): void
当接收到命令执行的输出时调用。
默认情况下,输出在任意边界处被分割成块。
如果您希望输出被分割成完整的行,请将splitOutputLines
设置为true。然后,回调函数会为每一行调用一次。
Since
0.2.0
参数
| Name | Type | Description |
|---|---|---|
data | { stdout: string; stderr?: undefined } | { stdout?: undefined; stderr: string } | Output content. Can include either stdout string, or stderr string, one at a time. |
返回
void
onError
• Optional onError: (error: any) => void
类型声明
▸ (error): void
如果执行的命令出错,则调用以报告错误。
参数
| Name | Type | Description |
|---|---|---|
error | any | The error happening in the executed command |
返回
void
onClose
• Optional onClose: (exitCode: number) => void
类型声明
▸ (exitCode): void
当进程退出时调用。
参数
| Name | Type | Description |
|---|---|---|
exitCode | number | The process exit code |
返回
void
splitOutputLines
• Optional Readonly splitOutputLines: boolean
指定调用 onOutput(data) 的行为。默认情况下为原始输出,可以在任何位置分割输出。如果设置为 true,onOutput 将为每一行调用一次。