| Index: client/cmd/isolate/archive.go
|
| diff --git a/client/cmd/isolate/archive.go b/client/cmd/isolate/archive.go
|
| index 5260bc5b1ef2cdab75b41af113dabec7c390c9fc..1c7290c5cdcc9a96954e4872be3e59fb98844326 100644
|
| --- a/client/cmd/isolate/archive.go
|
| +++ b/client/cmd/isolate/archive.go
|
| @@ -9,6 +9,7 @@ import (
|
| "fmt"
|
| "log"
|
| "os"
|
| + "os/signal"
|
| "path/filepath"
|
| "time"
|
|
|
| @@ -16,7 +17,6 @@ import (
|
| "github.com/maruel/subcommands"
|
|
|
| "github.com/luci/luci-go/client/archiver"
|
| - "github.com/luci/luci-go/client/internal/common"
|
| "github.com/luci/luci-go/client/isolate"
|
| "github.com/luci/luci-go/common/auth"
|
| "github.com/luci/luci-go/common/data/text/units"
|
| @@ -75,7 +75,7 @@ func (c *archiveRun) main(a subcommands.Application, args []string) error {
|
| }
|
| ctx := c.defaultFlags.MakeLoggingContext(os.Stderr)
|
| arch := archiver.New(ctx, isolatedclient.New(nil, client, c.isolatedFlags.ServerURL, c.isolatedFlags.Namespace, nil, nil), out)
|
| - common.CancelOnCtrlC(arch)
|
| + CancelOnCtrlC(arch)
|
| item := isolate.Archive(arch, &c.ArchiveOptions)
|
| item.WaitForHashed()
|
| if err = item.Error(); err != nil {
|
| @@ -130,3 +130,19 @@ func (c *archiveRun) Run(a subcommands.Application, args []string, _ subcommands
|
| }
|
| return 0
|
| }
|
| +
|
| +// CancelOnCtrlC is a temporary copy of the CancelOnCtrlC in internal/common/concurrent.go
|
| +// This is needed until the old archive and batcharchive code (which uses Cancelers) is removed.
|
| +// It operates on a concrete Archiver to avoid the dependency on Canceler.
|
| +func CancelOnCtrlC(arch *archiver.Archiver) {
|
| + interrupted := make(chan os.Signal, 1)
|
| + signal.Notify(interrupted, os.Interrupt)
|
| + go func() {
|
| + defer signal.Stop(interrupted)
|
| + select {
|
| + case <-interrupted:
|
| + arch.Cancel(errors.New("Ctrl-C"))
|
| + case <-arch.Channel():
|
| + }
|
| + }()
|
| +}
|
|
|