MCPcopy Index your code
hub / github.com/cloudflare/cloudflared / copyFile

Function copyFile

cmd/cloudflared/linux_service.go:442–467  ·  view source on GitHub ↗
(src, dest string)

Source from the content-addressed store, hash-verified

440}
441
442func copyFile(src, dest string) error {
443 srcFile, err := os.Open(src)
444 if err != nil {
445 return err
446 }
447 defer srcFile.Close()
448
449 destFile, err := os.Create(dest)
450 if err != nil {
451 return err
452 }
453 ok := false
454 defer func() {
455 destFile.Close()
456 if !ok {
457 _ = os.Remove(dest)
458 }
459 }()
460
461 if _, err := io.Copy(destFile, srcFile); err != nil {
462 return err
463 }
464
465 ok = true
466 return nil
467}

Callers 1

buildArgsForConfigFunction · 0.85

Calls 2

CloseMethod · 0.65
RemoveMethod · 0.65

Tested by

no test coverage detected