mirror of https://github.com/docker/cli.git
Merge pull request #2799 from tonistiigi/plugin-sigterm
handle sigterm on running a plugin
This commit is contained in:
commit
d1b4b61328
|
@ -15,6 +15,7 @@ import (
|
|||
"github.com/docker/cli/cli/version"
|
||||
"github.com/docker/docker/api/types/versions"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/moby/buildkit/util/appcontext"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -198,6 +199,11 @@ func tryPluginRun(dockerCli command.Cli, cmd *cobra.Command, subcommand string)
|
|||
return err
|
||||
}
|
||||
|
||||
go func() {
|
||||
// override SIGTERM handler so we let the plugin shut down first
|
||||
<-appcontext.Context().Done()
|
||||
}()
|
||||
|
||||
if err := plugincmd.Run(); err != nil {
|
||||
statusCode := 1
|
||||
exitErr, ok := err.(*exec.ExitError)
|
||||
|
|
Loading…
Reference in New Issue