2023-08-13 16:48:04 +03:00

20 lines
431 B
JavaScript

import execa from 'execa';
export async function runAppleScriptAsync(script) {
if (process.platform !== 'darwin') {
throw new Error('macOS only');
}
const {stdout} = await execa('osascript', ['-e', script]);
return stdout;
}
export function runAppleScriptSync(script) {
if (process.platform !== 'darwin') {
throw new Error('macOS only');
}
const {stdout} = execa.sync('osascript', ['-e', script]);
return stdout;
}