| 519 | } |
| 520 | |
| 521 | function preapproveFixtureUrlScheme() { |
| 522 | const plist = path.join( |
| 523 | os.homedir(), |
| 524 | "Library", |
| 525 | "Developer", |
| 526 | "CoreSimulator", |
| 527 | "Devices", |
| 528 | simulatorUDID, |
| 529 | "data", |
| 530 | "Library", |
| 531 | "Preferences", |
| 532 | "com.apple.launchservices.schemeapproval.plist", |
| 533 | ); |
| 534 | const key = `com.apple.CoreSimulator.CoreSimulatorBridge-->${fixtureUrlScheme}`; |
| 535 | fs.mkdirSync(path.dirname(plist), { recursive: true }); |
| 536 | const setResult = spawnSync( |
| 537 | "/usr/libexec/PlistBuddy", |
| 538 | ["-c", `Set :${key} ${fixtureBundleId}`, plist], |
| 539 | { |
| 540 | cwd: root, |
| 541 | encoding: "utf8", |
| 542 | timeout: 60_000, |
| 543 | }, |
| 544 | ); |
| 545 | if (setResult.status !== 0) { |
| 546 | runText( |
| 547 | "/usr/libexec/PlistBuddy", |
| 548 | ["-c", `Add :${key} string ${fixtureBundleId}`, plist], |
| 549 | { |
| 550 | timeoutMs: 60_000, |
| 551 | }, |
| 552 | ); |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | function shutdownSimulatorIfNeeded(udid) { |
| 557 | try { |