mirror of
https://github.com/docker/cli.git
synced 2026-01-25 03:42:05 +03:00
service logs: Support no-follow mode
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com> Upstream-commit: c2d435e4f05d262aaa3d4d5cc2fe8965377eebdf Component: engine
This commit is contained in:
@@ -1275,7 +1275,7 @@ func (c *Cluster) ServiceLogs(ctx context.Context, input string, config *backend
|
||||
ServiceIDs: []string{service.ID},
|
||||
},
|
||||
Options: &swarmapi.LogSubscriptionOptions{
|
||||
Follow: true,
|
||||
Follow: config.Follow,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
@@ -419,7 +419,11 @@ func (c *containerAdapter) logs(ctx context.Context, options api.LogSubscription
|
||||
}
|
||||
|
||||
chStarted := make(chan struct{})
|
||||
go c.backend.ContainerLogs(ctx, c.container.name(), apiOptions, chStarted)
|
||||
go func() {
|
||||
defer writer.Close()
|
||||
c.backend.ContainerLogs(ctx, c.container.name(), apiOptions, chStarted)
|
||||
}()
|
||||
|
||||
return reader, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user