Copy runs an scp command over the specified port. scpArgs should contain both scp flags as well as the list of files to copy, with the flags first. Remote files indicated by a "remote:" prefix are resolved relative to the remote user's home directory, and are subject to shell expansion on the remot
(ctx context.Context, scpArgs []string, port int, destination string)
| 40 | // to the remote user's home directory, and are subject to shell expansion |
| 41 | // on the remote host; see https://lwn.net/Articles/835962/. |
| 42 | func Copy(ctx context.Context, scpArgs []string, port int, destination string) error { |
| 43 | cmd, err := newSCPCommand(ctx, port, destination, scpArgs) |
| 44 | if err != nil { |
| 45 | return fmt.Errorf("failed to create scp command: %w", err) |
| 46 | } |
| 47 | |
| 48 | return cmd.Run() |
| 49 | } |
| 50 | |
| 51 | // NewRemoteCommand returns an exec.Cmd that will securely run a shell |
| 52 | // command on the remote machine. |
no test coverage detected