Skip to content
This repository has been archived by the owner on Dec 23, 2021. It is now read-only.

Commit

Permalink
Fix log stream did not close when stopped monitoring log.
Browse files Browse the repository at this point in the history
  • Loading branch information
skanehira committed Oct 7, 2019
1 parent 2e41f74 commit 0ef59df
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gui/keybindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"io"
"os"
"os/signal"
"path/filepath"
Expand Down Expand Up @@ -670,8 +671,11 @@ func (g *Gui) tailContainerLog() {
signal.Notify(sigint, os.Interrupt)
errCh := make(chan error)

var reader io.ReadCloser
var err error

go func() {
reader, err := docker.Client.ContainerLogStream(container.ID)
reader, err = docker.Client.ContainerLogStream(container.ID)
if err != nil {
common.Logger.Error(err)
errCh <- err
Expand All @@ -689,8 +693,10 @@ func (g *Gui) tailContainerLog() {
select {
case err := <-errCh:
common.Logger.Error(err)
reader.Close()
return
case <-sigint:
reader.Close()
return
}
}) {
Expand Down

0 comments on commit 0ef59df

Please sign in to comment.