Skip to content

Commit 19a2207

Browse files
authored
Merge pull request #27 from j-wang/main
2 parents 03fba2d + f605b3d commit 19a2207

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/applescript/execute.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { exec } from "child_process";
1+
import { execFile } from "child_process";
22
import { McpError, ErrorCode } from "@modelcontextprotocol/sdk/types.js";
33
export const executeJxa = <T>(script: string): Promise<T> => {
44
return new Promise((resolve, reject) => {
5-
const command = `osascript -l JavaScript -e '${script.replace(/'/g, "''")}'`;
6-
exec(command, (error, stdout, stderr) => {
5+
execFile("osascript", ["-l", "JavaScript", "-e", script], (error, stdout, stderr) => {
76
if (error) {
87
return reject(
98
new McpError(ErrorCode.InternalError, `JXA execution failed: ${error.message}`),

0 commit comments

Comments
 (0)