mirror of https://github.com/docker/cli.git
cmd/docker: fix some minor linting issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 5a38118956)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
60d16e20ac
commit
ed52ada4a3
|
|
@ -339,19 +339,19 @@ func tryPluginRun(ctx context.Context, dockerCli command.Cli, cmd *cobra.Command
|
||||||
// signals to the subprocess because the shared
|
// signals to the subprocess because the shared
|
||||||
// pgid makes the TTY a controlling terminal.
|
// pgid makes the TTY a controlling terminal.
|
||||||
//
|
//
|
||||||
// The plugin should have it's own copy of this
|
// The plugin should have its own copy of this
|
||||||
// termination logic, and exit after 3 retries
|
// termination logic, and exit after 3 retries
|
||||||
// on it's own.
|
// on its own.
|
||||||
if dockerCli.Out().IsTerminal() {
|
if dockerCli.Out().IsTerminal() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Terminate the plugin server, which will
|
// Terminate the plugin server, which closes
|
||||||
// close all connections with plugin
|
// all connections with plugin subprocesses,
|
||||||
// subprocesses, and signal them to exit.
|
// and signal them to exit.
|
||||||
//
|
//
|
||||||
// Repeated invocations will result in EINVAL,
|
// Repeated invocations result in EINVAL or EBADF,
|
||||||
// or EBADF; but that is fine for our purposes.
|
// but that is fine for our purposes.
|
||||||
if srv != nil {
|
if srv != nil {
|
||||||
_ = srv.Close()
|
_ = srv.Close()
|
||||||
}
|
}
|
||||||
|
|
@ -369,15 +369,15 @@ func tryPluginRun(ctx context.Context, dockerCli command.Cli, cmd *cobra.Command
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
retries := 0
|
retries := 0
|
||||||
force := false
|
|
||||||
// catch the first signal through context cancellation
|
// catch the first signal through context cancellation
|
||||||
<-ctx.Done()
|
<-ctx.Done()
|
||||||
tryTerminatePlugin(force)
|
tryTerminatePlugin(false)
|
||||||
|
|
||||||
// register subsequent signals
|
// register subsequent signals
|
||||||
signals := make(chan os.Signal, exitLimit)
|
signals := make(chan os.Signal, exitLimit)
|
||||||
signal.Notify(signals, platformsignals.TerminationSignals...)
|
signal.Notify(signals, platformsignals.TerminationSignals...)
|
||||||
|
|
||||||
|
force := false
|
||||||
for range signals {
|
for range signals {
|
||||||
retries++
|
retries++
|
||||||
// If we're still running after 3 interruptions
|
// If we're still running after 3 interruptions
|
||||||
|
|
@ -458,7 +458,7 @@ func runDocker(ctx context.Context, dockerCli *command.DockerCli) error {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprint(dockerCli.Err(), "Warning: Unexpected OTEL error, metrics may not be flushed")
|
_, _ = fmt.Fprint(dockerCli.Err(), "Warning: Unexpected OTEL error, metrics may not be flushed")
|
||||||
}
|
}
|
||||||
|
|
||||||
dockerCli.InstrumentCobraCommands(ctx, cmd)
|
dockerCli.InstrumentCobraCommands(ctx, cmd)
|
||||||
|
|
@ -473,8 +473,7 @@ func runDocker(ctx context.Context, dockerCli *command.DockerCli) error {
|
||||||
// We add plugin command stubs early only for completion. We don't
|
// We add plugin command stubs early only for completion. We don't
|
||||||
// want to add them for normal command execution as it would cause
|
// want to add them for normal command execution as it would cause
|
||||||
// a significant performance hit.
|
// a significant performance hit.
|
||||||
err = pluginmanager.AddPluginCommandStubs(dockerCli, cmd)
|
if err := pluginmanager.AddPluginCommandStubs(dockerCli, cmd); err != nil {
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue