diff options
author | Casey Lee <cplee@nektos.com> | 2020-02-24 21:48:12 +0100 |
---|---|---|
committer | Casey Lee <cplee@nektos.com> | 2020-02-24 21:48:12 +0100 |
commit | 037e08a3a77eb3d89d765213617e97e9691d83e3 (patch) | |
tree | dd00e6a9d808ea40aff04c46a431e0c7a3b2e20d /pkg/common | |
parent | unit tests pass (diff) | |
download | forgejo-act-037e08a3a77eb3d89d765213617e97e9691d83e3.tar.xz forgejo-act-037e08a3a77eb3d89d765213617e97e9691d83e3.zip |
integration test
Diffstat (limited to 'pkg/common')
-rw-r--r-- | pkg/common/git.go | 2 | ||||
-rw-r--r-- | pkg/common/line_writer.go | 7 | ||||
-rw-r--r-- | pkg/common/line_writer_test.go | 3 |
3 files changed, 8 insertions, 4 deletions
diff --git a/pkg/common/git.go b/pkg/common/git.go index 159141f..c7a059c 100644 --- a/pkg/common/git.go +++ b/pkg/common/git.go @@ -254,7 +254,7 @@ func NewGitCloneExecutor(input NewGitCloneExecutorInput) Executor { Force: true, }) if err != nil { - logger.Errorf("Unable to checkout %s: %v", refName, err) + logger.Errorf("Unable to checkout %s: %v", *hash, err) return err } diff --git a/pkg/common/line_writer.go b/pkg/common/line_writer.go index 4d1661b..2035199 100644 --- a/pkg/common/line_writer.go +++ b/pkg/common/line_writer.go @@ -6,7 +6,7 @@ import ( ) // LineHandler is a callback function for handling a line -type LineHandler func(line string) +type LineHandler func(line string) bool type lineWriter struct { buffer bytes.Buffer @@ -42,6 +42,9 @@ func (lw *lineWriter) Write(p []byte) (n int, err error) { func (lw *lineWriter) handleLine(line string) { for _, h := range lw.handlers { - h(line) + ok := h(line) + if !ok { + break + } } } diff --git a/pkg/common/line_writer_test.go b/pkg/common/line_writer_test.go index 462a20d..44e11ef 100644 --- a/pkg/common/line_writer_test.go +++ b/pkg/common/line_writer_test.go @@ -8,8 +8,9 @@ import ( func TestLineWriter(t *testing.T) { lines := make([]string, 0) - lineHandler := func(s string) { + lineHandler := func(s string) bool { lines = append(lines, s) + return true } lineWriter := NewLineWriter(lineHandler) |