time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

index.js (431B)


      1 import execa from 'execa';
      2 
      3 export async function runAppleScriptAsync(script) {
      4 	if (process.platform !== 'darwin') {
      5 		throw new Error('macOS only');
      6 	}
      7 
      8 	const {stdout} = await execa('osascript', ['-e', script]);
      9 	return stdout;
     10 }
     11 
     12 export function runAppleScriptSync(script) {
     13 	if (process.platform !== 'darwin') {
     14 		throw new Error('macOS only');
     15 	}
     16 
     17 	const {stdout} = execa.sync('osascript', ['-e', script]);
     18 	return stdout;
     19 }