Defined in: shell.ts:70
对齐 Tauri Command 类的命令构建器。stdout/stderr 经 ztron://shell-output / ztron://shell-error 事件流式送达。
new Command(
program,args?,options?):Command
Defined in: shell.ts:76
string
string[] = []
CommandOptions = {}
readonlyargs:string[]
Defined in: shell.ts:72
readonlyoptions:CommandOptions
Defined in: shell.ts:73
readonlyprogram:string
Defined in: shell.ts:71
execute():
Promise<ExecResult>
Defined in: shell.ts:163
运行命令并收集全量输出,resolve 为该输出。
Promise<ExecResult>
kill(
cid,signal?):Promise<void>
Defined in: shell.ts:158
终止已 spawn 的命令(默认 SIGTERM)。
string
number = 15
Promise<void>
on(
event,handler):this
Defined in: shell.ts:87
注册事件监听器;返回 this 以便链式调用。
CommandEvent
(data) => void
this
spawn():
Promise<void>
Defined in: shell.ts:99
spawn 命令并流式发出输出事件;进程退出时 resolve。
Promise<void>
spawnInteractive():
Promise<string>
Defined in: shell.ts:126
长驻 spawn:启动后 resolve 出命令 id;输出持续经 on("stdout"/"stderr") 流式送达,终止经 on("terminated")({cid, code})。配合 write 与 kill 驱动交互式进程。
Promise<string>
status():
Promise<number>
Defined in: shell.ts:197
运行命令并 resolve 其退出码。
Promise<number>
write(
cid,data):Promise<void>
Defined in: shell.ts:153
向已 spawn 命令的标准输入写入(spawnInteractive 返回的 cid)。
string
string
Promise<void>
staticsidecar():never
Defined in: shell.ts:202
不支持(Ztron 无 sidecar 打包)。
never
Defined in: shell.ts:59
optionalcwd?:string
Defined in: shell.ts:60
optionalenv?:Record<string,string>
Defined in: shell.ts:61
Defined in: shell.ts:5
code:
number
Defined in: shell.ts:6
stderr:
string
Defined in: shell.ts:8
stdout:
string
Defined in: shell.ts:7
constshell:object
Defined in: shell.ts:207
Command: typeof
Command
execute: (
program,args,options) =>Promise<ExecResult>
string
string[] = []
string
Record<string, string>
Promise<ExecResult>
executeStream: (
program,args,options) =>Promise<{code:number; }>
执行命令,stdout 块一到就回调 onChunk(适合长时命令)。resolve 为退出码。
string
string[] = []
object & object = {}
Promise<{ code: number; }>
open: (
url) =>Promise<{opened:boolean; }>
用默认浏览器打开 http(s) URL(发出后不等待)。
string
Promise<{ opened: boolean; }>
execute(
program,args?,options?):Promise<ExecResult>
Defined in: shell.ts:11
string
string[] = []
string
Record<string, string>
Promise<ExecResult>
executeStream(
program,args?,options?):Promise<{code:number; }>
Defined in: shell.ts:27
执行命令,stdout 块一到就回调 onChunk(适合长时命令)。resolve 为退出码。
string
string[] = []
object & object = {}
Promise<{ code: number; }>
open(
url):Promise<{opened:boolean; }>
Defined in: shell.ts:55
用默认浏览器打开 http(s) URL(发出后不等待)。
string
Promise<{ opened: boolean; }>