Skip to content

Commit

Permalink
Simplify code that unmutes logs
Browse files Browse the repository at this point in the history
Signed-off-by: David Gageot <david@gageot.net>
  • Loading branch information
dgageot committed Nov 21, 2018
1 parent 726f9f1 commit 8e53167
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions pkg/skaffold/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,13 @@ func (r *SkaffoldRunner) Dev(ctx context.Context, out io.Writer, artifacts []*la
// Create watcher and register artifacts to build current state of files.
changed := changes{}
onChange := func() error {
hasError := true

logger.Mute()
defer func() {
changed.reset()
r.Trigger.WatchForChanges(out)
if !hasError {
logger.Unmute()
}
}()

logger.Mute()

for _, a := range changed.dirtyArtifacts {
s, err := sync.NewItem(a.artifact, a.events, r.builds)
if err != nil {
Expand All @@ -277,7 +274,7 @@ func (r *SkaffoldRunner) Dev(ctx context.Context, out io.Writer, artifacts []*la
color.Default.Fprintf(out, "Syncing %d files for %s\n", len(s.Copy)+len(s.Delete), s.Image)

if err := r.Syncer.Sync(ctx, s); err != nil {
logrus.Warnln("Skipping build and deploy due to sync error:", err)
logrus.Warnln("Skipping deploy due to sync error:", err)
return nil
}
}
Expand Down Expand Up @@ -309,7 +306,7 @@ func (r *SkaffoldRunner) Dev(ctx context.Context, out io.Writer, artifacts []*la
}
}

hasError = false
logger.Unmute()
return nil
}

Expand Down

0 comments on commit 8e53167

Please sign in to comment.