diff --git a/pkg/devspace/services/sync/controller.go b/pkg/devspace/services/sync/controller.go index 12ab892802..2dafc779d5 100644 --- a/pkg/devspace/services/sync/controller.go +++ b/pkg/devspace/services/sync/controller.go @@ -226,6 +226,23 @@ func (c *controller) startWithWait(ctx devspacecontext.Context, options *Options } return nil }) + } else { + parent.Go(func() error { + select { + case <-ctx.Context().Done(): + syncStop(ctx, client, options, parent) + case err := <-onError: + hook.LogExecuteHooks(ctx.WithLogger(options.SyncLog), map[string]interface{}{ + "sync_config": options.SyncConfig, + "ERROR": err, + }, hook.EventsForSingle("error:sync", options.Name).With("sync.error")...) + ctx.Log().Errorf("Sync error: %v", err) + syncStop(ctx, client, options, parent) + case <-onDone: + syncDone(ctx, options, parent) + } + return nil + }) } return nil diff --git a/pkg/devspace/services/sync/sync.go b/pkg/devspace/services/sync/sync.go index e2dcb88c28..e1c740b138 100644 --- a/pkg/devspace/services/sync/sync.go +++ b/pkg/devspace/services/sync/sync.go @@ -124,7 +124,7 @@ func startSync(ctx devspacecontext.Context, name, arch string, syncConfig *lates Arch: arch, Starter: starter, - RestartOnError: true, + RestartOnError: !syncConfig.NoWatch, Verbose: ctx.Log().GetLevel() == logrus.DebugLevel, }