Browse Source

add log when copying files/directories between host and containers (both way)

Signed-off-by: Guillaume Lours <[email protected]>
Guillaume Lours 2 years ago
parent
commit
fdc1738143
1 changed files with 8 additions and 8 deletions
  1. 8 8
      pkg/compose/cp.go

+ 8 - 8
pkg/compose/cp.go

@@ -82,15 +82,15 @@ func (s *composeService) Copy(ctx context.Context, projectName string, options a
 	for _, cont := range containers {
 		container := cont
 		g.Go(func() error {
-			err := copyFunc(ctx, container.ID, srcPath, dstPath, options)
-			if s.dryRun && err == nil {
-				fromOrInside := "inside"
-				if direction == fromService {
-					fromOrInside = "from"
-				}
-				fmt.Printf("Copy %s to path %s %s %s service container\n", srcPath, dstPath, fromOrInside, getCanonicalContainerName(container))
+			if err := copyFunc(ctx, container.ID, srcPath, dstPath, options); err != nil {
+				return err
 			}
-			return err
+			fromOrInside := "inside"
+			if direction == fromService {
+				fromOrInside = "from"
+			}
+			fmt.Fprintf(s.stderr(), "Copy %s to path %s %s %s service container\n", srcPath, dstPath, fromOrInside, getCanonicalContainerName(container))
+			return nil
 		})
 	}