Skip to content

Commit

Permalink
#274 Fix stdout explicitly using follow flag (#275)
Browse files Browse the repository at this point in the history
* #274 Fix stdout explicitly using follow flag
* Fix linting
  • Loading branch information
fubarhouse committed Nov 10, 2020
1 parent fb9b78c commit da80a22
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion service/interface/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ func DockerContainerStart(ID string, options types.ContainerStartOptions) error
return err
}

func DockerContainerLogs(ID string) ([]byte, error) {
func DockerContainerLogs(ID string, Follow bool) ([]byte, error) {
ctx := context.Background()
cli, err := client.NewClientWithOpts()
cli.NegotiateAPIVersion(ctx)
Expand All @@ -458,6 +458,7 @@ func DockerContainerLogs(ID string) ([]byte, error) {
b, _ := cli.ContainerLogs(ctx, ID, types.ContainerLogsOptions{
ShowStdout: true,
ShowStderr: true,
Follow: Follow,
})

buf := new(bytes.Buffer)
Expand Down
4 changes: 2 additions & 2 deletions service/interface/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (Service *Service) GetRunning() (types.Container, error) {
containers, _ := docker.DockerContainerList()
for _, container := range containers {
if _, ok := container.Labels["pygmy.name"]; ok {
if strings.Contains(container.Names[0], Service.Config.Labels["pygmy.name"]) {
if strings.Contains(container.Labels["pygmy.name"], Service.Config.Labels["pygmy.name"]) {
return container, nil
}
}
Expand Down Expand Up @@ -259,6 +259,6 @@ func (Service *Service) DockerRun() ([]byte, error) {
return []byte{}, err
}

return docker.DockerContainerLogs(resp.ID)
return docker.DockerContainerLogs(resp.ID, Service.HostConfig.AutoRemove)

}

0 comments on commit da80a22

Please sign in to comment.