| 48 | } |
| 49 | |
| 50 | func (e *HostEnvironment) Copy(destPath string, files ...*FileEntry) common.Executor { |
| 51 | return func(_ context.Context) error { |
| 52 | for _, f := range files { |
| 53 | if err := os.MkdirAll(filepath.Dir(filepath.Join(destPath, f.Name)), 0o777); err != nil { |
| 54 | return err |
| 55 | } |
| 56 | if err := os.WriteFile(filepath.Join(destPath, f.Name), []byte(f.Body), fs.FileMode(f.Mode)); err != nil { |
| 57 | return err |
| 58 | } |
| 59 | } |
| 60 | return nil |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | func (e *HostEnvironment) CopyTarStream(ctx context.Context, destPath string, tarStream io.Reader) error { |
| 65 | if err := os.RemoveAll(destPath); err != nil { |