MCPcopy
hub / github.com/docker/compose / CopyFile

Function CopyFile

pkg/e2e/framework.go:247–262  ·  pkg/e2e/framework.go::CopyFile

CopyFile copies a file from a sourceFile to a destinationFile setting permissions to 0755

(t testing.TB, sourceFile string, destinationFile string)

Source from the content-addressed store, hash-verified

245
246// CopyFile copies a file from a sourceFile to a destinationFile setting permissions to 0755
247func CopyFile(t testing.TB, sourceFile string, destinationFile string) {
248 t.Helper()
249
250 src, err := os.Open(sourceFile)
251 assert.NilError(t, err, "Failed to open source file: %s")
252 //nolint:errcheck
253 defer src.Close()
254
255 dst, err := os.OpenFile(destinationFile, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o755)
256 assert.NilError(t, err, "Failed to open destination file: %s", destinationFile)
257 //nolint:errcheck
258 defer dst.Close()
259
260 _, err = io.Copy(dst, src)
261 assert.NilError(t, err, "Failed to copy file: %s", sourceFile)
262}
263
264// BaseEnvironment provides the minimal environment variables used across all
265// Docker / Compose commands.

Callers 8

doTestFunction · 0.85
TestWatchExecFunction · 0.85
TestWatchMultiServicesFunction · 0.85
TestWatchIncludesFunction · 0.85
copyLocalConfigFunction · 0.85
initializePluginsFunction · 0.85

Calls 2

CloseMethod · 0.65
CopyMethod · 0.65

Tested by 6

doTestFunction · 0.68
TestWatchExecFunction · 0.68
TestWatchMultiServicesFunction · 0.68
TestWatchIncludesFunction · 0.68