File tree Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ require (
11
11
github.com/pkg/term v1.2.0-beta.2
12
12
github.com/shirou/gopsutil/v3 v3.23.8
13
13
github.com/spf13/pflag v1.0.5
14
+ golang.design/x/chann v0.1.2
14
15
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
15
16
golang.org/x/sys v0.12.0
16
17
golang.org/x/term v0.12.0
@@ -27,3 +28,6 @@ require (
27
28
github.com/tklauser/numcpus v0.6.1 // indirect
28
29
github.com/yusufpapurcu/wmi v1.2.3 // indirect
29
30
)
31
+
32
+ // https://github.com/golang-design/chann/pull/5
33
+ replace golang.design/x/chann v0.1.2 => github.com/amyangfei/chann v0.0.0-20230110021018-bca7d685828c
Original file line number Diff line number Diff line change 1
1
github.com/alessio/shellescape v1.4.2 h1:MHPfaU+ddJ0/bYWpgIeUnQUqKrlJ1S7BfEYPM4uEoM0 =
2
2
github.com/alessio/shellescape v1.4.2 /go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30 =
3
+ github.com/amyangfei/chann v0.0.0-20230110021018-bca7d685828c h1:4tmBsdlMK6MWi6sgiWxazvQb2KCAyudUvq2cOg06xag =
4
+ github.com/amyangfei/chann v0.0.0-20230110021018-bca7d685828c /go.mod h1:Rh5KhCAp+0qu9+FfKPymHpu8onmjl89sFwMeiw3SK14 =
3
5
github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY =
4
6
github.com/creack/pty v1.1.18 /go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4 =
5
7
github.com/davecgh/go-spew v1.1.0 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import (
19
19
"github.com/fatih/color"
20
20
"github.com/mattn/go-isatty"
21
21
"github.com/pkg/term/termios"
22
+ "golang.design/x/chann"
22
23
"golang.org/x/exp/slices"
23
24
"golang.org/x/term"
24
25
)
@@ -296,23 +297,22 @@ func main() {
296
297
}
297
298
}
298
299
299
- // TODO: there's now basically no limit with flRecursiveProcessLimit being false
300
- processes := make (chan * ProcessResult , 32 * 1024 )
300
+ processes := chann .New [* ProcessResult ]()
301
301
go func () {
302
- defer close ( processes )
302
+ defer processes . Close ( )
303
303
304
304
if * flQueueWait {
305
- startProcessesFromQueue (processes )
305
+ startProcessesFromQueue (processes . In () )
306
306
return
307
307
}
308
308
309
309
if args .hasTripleColon {
310
- startProcessesFromCliArguments (args , processes )
310
+ startProcessesFromCliArguments (args , processes . In () )
311
311
}
312
312
if * flFromStdin {
313
- startProcessesFromStdin (args , processes )
313
+ startProcessesFromStdin (args , processes . In () )
314
314
}
315
315
}()
316
316
317
- os .Exit (displaySequentially (processes ))
317
+ os .Exit (displaySequentially (processes . Out () ))
318
318
}
You can’t perform that action at this time.
0 commit comments