MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / SystemExecutor

Class SystemExecutor

warp/warp.ts:19–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17// 获取命令前缀
18const prefixes = getPrefixes();
19const mainPrefix = prefixes[0] || ".";
20// 命令执行统一封装
21class SystemExecutor {
22 static async run(cmd: string): Promise<{ success: boolean; output: string; error?: string }> {
23 try {
24 const { stdout, stderr } = await execAsync(cmd);
25 return { success: true, output: String(stdout ?? "").trim(), error: String(stderr ?? "").trim() };
26 } catch (e: any) {
27 return {
28 success: false,
29 output: String(e?.stdout ?? "").trim(),
30 error: String(e?.stderr ?? e?.message ?? e ?? "").trim(),
31 };
32 }
33 }
34
35 static async runSudo(cmd: string): Promise<{ success: boolean; output: string; error?: string }> {
36 return this.run(`sudo ${cmd}`);
37 }
38 }
39

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected