({ debugPort, userDataRoot, disablePersistedMetaCache, appPath })
| 273 | } |
| 274 | |
| 275 | function startDesktopRuntime({ debugPort, userDataRoot, disablePersistedMetaCache, appPath }) { |
| 276 | const runtimePath = appPath ? packagedAppExecutablePath(appPath) : electronPath |
| 277 | const runtimeArgs = appPath |
| 278 | ? [`--remote-debugging-port=${debugPort}`, '--js-flags=--expose-gc'] |
| 279 | : [`--remote-debugging-port=${debugPort}`, '--js-flags=--expose-gc', desktopOutMain] |
| 280 | const child = spawn(runtimePath, runtimeArgs, { |
| 281 | cwd: repoRoot, |
| 282 | env: { |
| 283 | ...process.env, |
| 284 | ELECTRON_DISABLE_SECURITY_WARNINGS: '1', |
| 285 | ZEN_PERF: '1', |
| 286 | ZENNOTES_USER_DATA_PATH: userDataRoot, |
| 287 | ...(disablePersistedMetaCache ? { ZEN_PERF_DISABLE_PERSISTED_META_CACHE: '1' } : {}) |
| 288 | }, |
| 289 | stdio: ['ignore', 'pipe', 'pipe'] |
| 290 | }) |
| 291 | let log = '' |
| 292 | child.stdout.on('data', (chunk) => { |
| 293 | log = appendBounded(log, chunk) |
| 294 | }) |
| 295 | child.stderr.on('data', (chunk) => { |
| 296 | log = appendBounded(log, chunk) |
| 297 | }) |
| 298 | return { |
| 299 | child, |
| 300 | log: () => log |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | class CdpClient { |
| 305 | constructor(webSocketUrl) { |
no test coverage detected