MCPcopy Create free account
hub / github.com/compozy/agh / spawnDetached

Method spawnDetached

internal/cli/cli_integration_test.go:3543–3570  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3541}
3542
3543func (d *integrationDaemon) spawnDetached() (daemonProcess, error) {
3544 d.mu.Lock()
3545 defer d.mu.Unlock()
3546 if d.running {
3547 return nil, errors.New("integration daemon already running")
3548 }
3549
3550 ctx, cancel := context.WithCancel(context.Background())
3551 waitCh := make(chan error, 1)
3552 done := make(chan struct{})
3553 d.running = true
3554 d.cancel = cancel
3555 d.done = waitCh
3556
3557 go func() {
3558 err := d.Run(ctx)
3559 waitCh <- err
3560 close(waitCh)
3561 close(done)
3562 d.mu.Lock()
3563 d.running = false
3564 d.cancel = nil
3565 d.done = nil
3566 d.mu.Unlock()
3567 }()
3568
3569 return &integrationDaemonProcess{pid: d.pid, done: done, waitCh: waitCh}, nil
3570}
3571
3572func (d *integrationDaemon) Run(ctx context.Context) error {
3573 registry, err := globaldb.OpenGlobalDB(context.Background(), d.homePaths.DatabaseFile)

Callers 2

newIntegrationHarnessFunction · 0.95
runDaemonDetachedFunction · 0.80

Calls 1

RunMethod · 0.95

Tested by

no test coverage detected