MCPcopy Index your code
hub / github.com/ZToolsCenter/ZTools / execAppleScript

Method execAppleScript

src/main/api/plugin/shell.ts:372–382  ·  view source on GitHub ↗

* 执行 AppleScript 命令并返回标准输出 * 使用 execFile 而非 exec,避免 shell 解释,防止潜在的命令注入风险 * @param script - AppleScript 脚本内容 * @returns 命令输出字符串

(script: string)

Source from the content-addressed store, hash-verified

370 * @returns 命令输出字符串
371 */
372 private execAppleScript(script: string): Promise<string> {
373 return new Promise((resolve, reject) => {
374 execFile('osascript', ['-e', script], (error, stdout) => {
375 if (error) {
376 reject(error)
377 } else {
378 resolve(stdout)
379 }
380 })
381 })
382 }
383}
384
385export default new PluginShellAPI()

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected