style(desktop): format close-stop handling
This commit is contained in:
@@ -44,21 +44,25 @@ test('close/stop inventories owned PIDs after the tree kill and clears only unhe
|
|||||||
const cleared: string[] = []
|
const cleared: string[] = []
|
||||||
const alive = new Set([9001])
|
const alive = new Set([9001])
|
||||||
|
|
||||||
const result = finishWindowsCloseStop([4242, 9001], [
|
const result = finishWindowsCloseStop(
|
||||||
{ path: 'gone.lock', holderPids: [4242] },
|
[4242, 9001],
|
||||||
{ path: 'still-held.lock', holderPids: [9001] },
|
[
|
||||||
{ path: 'foreign-held.lock', holderPids: [7777], held: true },
|
{ path: 'gone.lock', holderPids: [4242] },
|
||||||
{ path: 'no-holder.lock', holderPids: [] }
|
{ path: 'still-held.lock', holderPids: [9001] },
|
||||||
], {
|
{ path: 'foreign-held.lock', holderPids: [7777], held: true },
|
||||||
killTree: pid => {
|
{ path: 'no-holder.lock', holderPids: [] }
|
||||||
killed.push(pid)
|
],
|
||||||
alive.delete(pid === 4242 ? 4242 : -1)
|
{
|
||||||
},
|
killTree: pid => {
|
||||||
isPidAlive: pid => alive.has(pid),
|
killed.push(pid)
|
||||||
clearLock: path => {
|
alive.delete(pid === 4242 ? 4242 : -1)
|
||||||
cleared.push(path)
|
},
|
||||||
|
isPidAlive: pid => alive.has(pid),
|
||||||
|
clearLock: path => {
|
||||||
|
cleared.push(path)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
)
|
||||||
|
|
||||||
assert.deepEqual(killed, [4242, 9001], 'does not widen the tree-kill to foreign holders')
|
assert.deepEqual(killed, [4242, 9001], 'does not widen the tree-kill to foreign holders')
|
||||||
assert.deepEqual(result.remainingPids, [9001])
|
assert.deepEqual(result.remainingPids, [9001])
|
||||||
|
|||||||
@@ -12340,12 +12340,15 @@ function releaseHostSpawnReservation() {
|
|||||||
hostSpawnReservation = null
|
hostSpawnReservation = null
|
||||||
}
|
}
|
||||||
|
|
||||||
function startHermes({ supervisorRecovery = false }: { supervisorRecovery?: boolean } = {}): Promise<Awaited<ReturnType<typeof backendConnectionState.getPromise>>> {
|
function startHermes({ supervisorRecovery = false }: { supervisorRecovery?: boolean } = {}): Promise<
|
||||||
|
Awaited<ReturnType<typeof backendConnectionState.getPromise>>
|
||||||
|
> {
|
||||||
primaryRecoverySuppressed = false
|
primaryRecoverySuppressed = false
|
||||||
primaryStartsInFlight += 1
|
primaryStartsInFlight += 1
|
||||||
|
|
||||||
const start: Promise<Awaited<ReturnType<typeof backendConnectionState.getPromise>>> =
|
const start: Promise<Awaited<ReturnType<typeof backendConnectionState.getPromise>>> = localBackendLifecycle.start(
|
||||||
localBackendLifecycle.start(() => runHermesStart({ supervisorRecovery }))
|
() => runHermesStart({ supervisorRecovery })
|
||||||
|
)
|
||||||
|
|
||||||
const releaseStart = (): void => {
|
const releaseStart = (): void => {
|
||||||
primaryStartsInFlight -= 1
|
primaryStartsInFlight -= 1
|
||||||
@@ -12461,7 +12464,9 @@ function latchedBootFailure(): Error | null {
|
|||||||
return bootstrapFailure ?? backendStartFailure ?? remoteReauthFailure ?? null
|
return bootstrapFailure ?? backendStartFailure ?? remoteReauthFailure ?? null
|
||||||
}
|
}
|
||||||
|
|
||||||
async function runHermesStart({ supervisorRecovery = false }: { supervisorRecovery?: boolean } = {}): Promise<Awaited<ReturnType<typeof backendConnectionState.getPromise>>> {
|
async function runHermesStart({ supervisorRecovery = false }: { supervisorRecovery?: boolean } = {}): Promise<
|
||||||
|
Awaited<ReturnType<typeof backendConnectionState.getPromise>>
|
||||||
|
> {
|
||||||
// Only the single-instance lock holder may reap/spawn/claim the desktop
|
// Only the single-instance lock holder may reap/spawn/claim the desktop
|
||||||
// backend. A lock-losing instance must stay inert even if some path reaches
|
// backend. A lock-losing instance must stay inert even if some path reaches
|
||||||
// here (e.g. the deferred-quit window before `ready`): its reapOrphans()
|
// here (e.g. the deferred-quit window before `ready`): its reapOrphans()
|
||||||
|
|||||||
Reference in New Issue
Block a user