Skip to content

Commit 21a297e

Browse files
authored
Merge pull request #157 from covexo/fix-sync-problem
Fix panic in CopyToContainer
2 parents efe6e6a + 454f434 commit 21a297e

3 files changed

Lines changed: 21 additions & 6 deletions

File tree

Gopkg.lock

Lines changed: 10 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/devspace/sync/sync_config.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,25 @@ type SyncConfig struct {
4747
upstream *upstream
4848
downstream *downstream
4949

50+
silent bool
51+
5052
// Used for testing
5153
testing bool
5254
errorChan chan error
5355
}
5456

5557
// Logf prints the given information to the synclog with context data
5658
func (s *SyncConfig) Logf(format string, args ...interface{}) {
57-
syncLog.WithKey("local", s.WatchPath).WithKey("container", s.DestPath).WithKey("excluded", s.ExcludePaths).Infof(format, args...)
59+
if s.silent == false {
60+
syncLog.WithKey("local", s.WatchPath).WithKey("container", s.DestPath).WithKey("excluded", s.ExcludePaths).Infof(format, args...)
61+
}
5862
}
5963

6064
// Logln prints the given information to the synclog with context data
6165
func (s *SyncConfig) Logln(line interface{}) {
62-
syncLog.WithKey("local", s.WatchPath).WithKey("container", s.DestPath).WithKey("excluded", s.ExcludePaths).Info(line)
66+
if s.silent == false {
67+
syncLog.WithKey("local", s.WatchPath).WithKey("container", s.DestPath).WithKey("excluded", s.ExcludePaths).Info(line)
68+
}
6369
}
6470

6571
// Error handles a sync error with context
@@ -334,7 +340,7 @@ func (s *SyncConfig) diffDir(filepath string, sendChanges *[]*fileInformation, d
334340

335341
//Stop stops the sync process
336342
func (s *SyncConfig) Stop() {
337-
if s.upstream != nil {
343+
if s.upstream != nil && s.upstream.interrupt != nil {
338344
select {
339345
case <-s.upstream.interrupt:
340346
default:
@@ -355,7 +361,7 @@ func (s *SyncConfig) Stop() {
355361
}
356362
}
357363

358-
if s.downstream != nil {
364+
if s.downstream != nil && s.downstream.interrupt != nil {
359365
select {
360366
case <-s.downstream.interrupt:
361367
default:

pkg/devspace/sync/util.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func CopyToContainer(Kubectl *kubernetes.Clientset, Pod *k8sv1.Pod, Container *k
3636
WatchPath: getRelativeFromFullPath(LocalPath, ""),
3737
DestPath: ContainerPath,
3838
ExcludePaths: ExcludePaths,
39+
silent: true,
3940
}
4041

4142
syncLog = log.GetInstance()

0 commit comments

Comments
 (0)