We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 03fba2d + f605b3d commit 19a2207Copy full SHA for 19a2207
1 file changed
src/applescript/execute.ts
@@ -1,9 +1,8 @@
1
-import { exec } from "child_process";
+import { execFile } from "child_process";
2
import { McpError, ErrorCode } from "@modelcontextprotocol/sdk/types.js";
3
export const executeJxa = <T>(script: string): Promise<T> => {
4
return new Promise((resolve, reject) => {
5
- const command = `osascript -l JavaScript -e '${script.replace(/'/g, "''")}'`;
6
- exec(command, (error, stdout, stderr) => {
+ execFile("osascript", ["-l", "JavaScript", "-e", script], (error, stdout, stderr) => {
7
if (error) {
8
return reject(
9
new McpError(ErrorCode.InternalError, `JXA execution failed: ${error.message}`),
0 commit comments