返回 DeepSeek-Reasonix
startup_inspection_windows.go
根目录 / internal / desktopinstance / startup_inspection_windows.go
1 //go:build windows
2
3 package desktopinstance
4
5 import (
6 "errors"
7 "time"
8 )
9
10 // Startup may race Chromium child teardown. Wait within the existing startup
11 // deadline for a fully inspectable snapshot; never report readiness from an
12 // incomplete snapshot or relax recovery's immediate ownership checks.
13 func waitForInspectable(inspect func() ([]*process, error), remaining func() time.Duration, wait func(time.Duration)) ([]*process, error) {
14 for {
15 list, err := inspect()
16 var failure *Error
17 if !errors.As(err, &failure) || failure.Code != UnknownOwner {
18 return list, err
19 }
20 left := remaining()
21 if left <= 0 {
22 return nil, err
23 }
24 wait(min(left, 200*time.Millisecond))
25 }
26 }
27
27 lines GO