(src, dst string)
| 381 | } |
| 382 | |
| 383 | func copyFile(src, dst string) error { |
| 384 | in, err := os.Open(src) |
| 385 | if err != nil { |
| 386 | return err |
| 387 | } |
| 388 | defer in.Close() |
| 389 | out, err := os.OpenFile(dst, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0o755) |
| 390 | if err != nil { |
| 391 | return err |
| 392 | } |
| 393 | defer out.Close() |
| 394 | if _, err := io.Copy(out, in); err != nil { |
| 395 | return err |
| 396 | } |
| 397 | return out.Sync() |
| 398 | } |
| 399 | |
| 400 | // finalizeWindowsSwap attempts to replace tnr.exe with a previously staged tnr.new. |
| 401 | // It is a no-op on non-Windows platforms. |
no test coverage detected