跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

process_wait.go

30 行 · 836 B历史下载
1// SPDX-FileCopyrightText: Copyright The Lima Authors
2// SPDX-License-Identifier: Apache-2.0
3
4package qemu
5
6import "sync"
7
8// watchQEMU reports process exit and network setup failures on the driver's
9// existing wait channel. afterExit cancels setup and releases the netstack.
10func watchQEMU(wait, configure func() error, afterExit func()) chan error {
11 // Each producer can publish once even when Start's caller has stopped
12 // receiving. Only the coordinator closes the channel, after both finish.
13 errors := make(chan error, 2)
14 var producers sync.WaitGroup
15 producers.Add(2)
16 go func() {
17 defer producers.Done()
18 err := wait()
19 afterExit()
20 errors <- err
21 }()
22 go func() {
23 defer producers.Done()
24 if err := configure(); err != nil {
25 errors <- err
26 }
27 }()
28 go func() { producers.Wait(); close(errors) }()
29 return errors
30}