MCPcopy Index your code
hub / github.com/devspace-sh/devspace / Copy

Method Copy

pkg/devspace/kubectl/copy.go:36–52  ·  view source on GitHub ↗

Copy copies the specified folder to the container

(ctx context.Context, pod *k8sv1.Pod, container, containerPath, localPath string, exclude []string)

Source from the content-addressed store, hash-verified

34
35// Copy copies the specified folder to the container
36func (client *client) Copy(ctx context.Context, pod *k8sv1.Pod, container, containerPath, localPath string, exclude []string) error {
37 // do the actual copy
38 reader, writer := io.Pipe()
39 errorChan := make(chan error)
40 go func() {
41 defer reader.Close()
42 errorChan <- client.CopyFromReader(ctx, pod, container, containerPath, reader)
43 }()
44 go func() {
45 defer writer.Close()
46 errorChan <- writeTar(writer, localPath, exclude)
47 }()
48 err := <-errorChan
49 // wait for the second goroutine to finish
50 <-errorChan
51 return err
52}
53
54func writeTar(writer io.Writer, localPath string, exclude []string) error {
55 absolute, err := filepath.Abs(localPath)

Callers

nothing calls this directly

Calls 3

CopyFromReaderMethod · 0.95
writeTarFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected