A session of `install` attached to a daemon of its own, which owns the project.
(install: string, version: string, env: NodeJS.ProcessEnv = {})
| 498 | |
| 499 | /** A session of `install` attached to a daemon of its own, which owns the project. */ |
| 500 | async function sessionWithDaemon(install: string, version: string, env: NodeJS.ProcessEnv = {}): Promise<{ session: Session; pid: number }> { |
| 501 | const session = startSession(install, env); |
| 502 | await waitFor(() => attachedLine(session), 20000, `the ${version} session to attach`); |
| 503 | // Attached means listening, not initialized: let the engine open the |
| 504 | // database before anything stops this daemon. |
| 505 | await status(session, 2, `a ${version} tool call`); |
| 506 | const lock = daemonLock(); |
| 507 | expect(lock).toMatchObject({ version }); |
| 508 | expect(writerLock()).toMatchObject({ pid: lock.pid, mode: 'daemon' }); |
| 509 | daemonPids.add(lock.pid); |
| 510 | return { session, pid: lock.pid }; |
| 511 | } |
| 512 | |
| 513 | /** A daemon process for the project, started the way a launcher starts one. */ |
| 514 | function startDaemon(env: NodeJS.ProcessEnv): { child: ChildProcessWithoutNullStreams; log: string[] } { |
no test coverage detected