mirror of
https://github.com/stablyai/orca.git
synced 2026-10-28 08:02:54 +00:00
fix: address pr-bug-scan validated finding from #7174
Made resolveServeSimExecutable() lazy in IosEmulatorBackend via a cached getter; constructor no longer triggers the startup cpSync+xattr on darwin first-launch.
This commit is contained in:
@@ -46,14 +46,25 @@ export class IosEmulatorBackend implements EmulatorBackend {
|
||||
logcat: false
|
||||
}
|
||||
|
||||
private readonly serveSimExecutable: ServeSimExecutable
|
||||
private serveSimExecutableCache: ServeSimExecutable | undefined
|
||||
private readonly waitForEndpointReady: (endpoint: string) => Promise<boolean>
|
||||
|
||||
constructor(options: EmulatorBridgeOptions = {}) {
|
||||
this.serveSimExecutable = resolveServeSimExecutable()
|
||||
this.waitForEndpointReady = options.waitForEndpointReady ?? waitForServeSimEndpointReady
|
||||
}
|
||||
|
||||
// Why: resolving the executable can materialize the serve-sim runtime (a
|
||||
// recursive copy + xattr subprocess on darwin first-launch-per-version), so
|
||||
// defer it to first actual use. Constructing this backend at app startup
|
||||
// (inside app.whenReady, before the main window opens) must not block the
|
||||
// main thread on that work.
|
||||
private get serveSimExecutable(): ServeSimExecutable {
|
||||
if (!this.serveSimExecutableCache) {
|
||||
this.serveSimExecutableCache = resolveServeSimExecutable()
|
||||
}
|
||||
return this.serveSimExecutableCache
|
||||
}
|
||||
|
||||
isSupportedOnHost(): boolean {
|
||||
return platform() === 'darwin'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user