* 执行 AppleScript 命令并返回标准输出 * 使用 execFile 而非 exec,避免 shell 解释,防止潜在的命令注入风险 * @param script - AppleScript 脚本内容 * @returns 命令输出字符串
(script: string)
| 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 | |
| 385 | export default new PluginShellAPI() |
no outgoing calls
no test coverage detected