Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function _isSimulatorInstalledAsync() {
let result;
try {
result = (await osascript.execAsync('id of app "Simulator"')).trim();
} catch (e) {
console.error(
"Can't determine id of Simulator app; the Simulator is most likely not installed on this machine",
e
);
Logger.global.error(XCODE_NOT_INSTALLED_ERROR);
return false;
}
if (
result !== 'com.apple.iphonesimulator' &&
result !== 'com.apple.CoreSimulator.SimulatorTrampoline'
) {
console.warn(
"Simulator is installed but is identified as '" + result + "'; don't know what that is."
);
Logger.global.error(XCODE_NOT_INSTALLED_ERROR);
export async function _isSimulatorRunningAsync() {
let zeroMeansNo = (
await osascript.execAsync(
'tell app "System Events" to count processes whose name is "Simulator"'
)
).trim();
if (zeroMeansNo === '0') {
return false;
}
return true;
}
export async function _quitSimulatorAsync() {
return await osascript.execAsync('tell application "Simulator" to quit');
}