mirror of https://github.com/docker/buildx.git
remote: avoid signal names map on init
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
parent
52bb668085
commit
96509847b9
|
@ -207,6 +207,7 @@ func attachIO(ctx context.Context, stream msgStream, initMessage *pb.InitMessage
|
||||||
|
|
||||||
if cfg.signal != nil {
|
if cfg.signal != nil {
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
|
names := signalNames()
|
||||||
for {
|
for {
|
||||||
var sig syscall.Signal
|
var sig syscall.Signal
|
||||||
select {
|
select {
|
||||||
|
@ -216,7 +217,7 @@ func attachIO(ctx context.Context, stream msgStream, initMessage *pb.InitMessage
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
name := sigToName[sig]
|
name := names[sig]
|
||||||
if name == "" {
|
if name == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -380,12 +381,12 @@ func copyToStream(fd uint32, snd msgStream, r io.Reader) error {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var sigToName = map[syscall.Signal]string{}
|
func signalNames() map[syscall.Signal]string {
|
||||||
|
m := make(map[syscall.Signal]string, len(signal.SignalMap))
|
||||||
func init() {
|
|
||||||
for name, value := range signal.SignalMap {
|
for name, value := range signal.SignalMap {
|
||||||
sigToName[value] = name
|
m[value] = name
|
||||||
}
|
}
|
||||||
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
type debugStream struct {
|
type debugStream struct {
|
||||||
|
|
Loading…
Reference in New Issue