Skip to content

Commit b1b4890

Browse files
committed
fix(redteam-ctl): print log output on first poll too
1 parent cb7db32 commit b1b4890

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

redteam/cmd/redteam-ctl/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,10 @@ func pullLog(env *codewire.Environment, dest string, lastSize *int64, logger *lo
148148

149149
os.WriteFile(dest, data, 0644)
150150

151-
if *lastSize > 0 && newSize > *lastSize {
152-
for _, line := range strings.Split(string(data[*lastSize:]), "\n") {
151+
if newSize > *lastSize {
152+
start := *lastSize
153+
if start < 0 { start = 0 }
154+
for _, line := range strings.Split(string(data[start:]), "\n") {
153155
if line = strings.TrimSpace(line); line != "" {
154156
logger.Println(line)
155157
}

0 commit comments

Comments
 (0)