Skip to content

Commit

Permalink
Added --cmd-path flag to specify the remote command path in case it's…
Browse files Browse the repository at this point in the history
… different. Closes dop251#17.
  • Loading branch information
dop251 committed Apr 21, 2022
1 parent 9c8674c commit 43721ec
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion diskrsync/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const (

type options struct {
sshFlags string
cmdPath string
noCompress bool
verbose bool
}
Expand Down Expand Up @@ -144,7 +145,13 @@ func (p *remoteProc) Start(cmdReader io.Reader, cmdWriter io.WriteCloser, errCha
args = append(args, flags...)
}

args = append(args, p.host, os.Args[0])
var cmdPath string
if cp := p.opts.cmdPath; cp != "" {
cmdPath = cp
} else {
cmdPath = os.Args[0]
}
args = append(args, p.host, cmdPath)

if p.mode == modeSource {
args = append(args, "--source")
Expand Down Expand Up @@ -460,6 +467,7 @@ func main() {
var opts options

flag.StringVar(&opts.sshFlags, "ssh-flags", "", "SSH flags")
flag.StringVar(&opts.cmdPath, "cmd-path", "", "Remote command path (defaults to argv[0])")
flag.BoolVar(&opts.noCompress, "no-compress", false, "Store target as a raw file")
flag.BoolVar(&opts.verbose, "verbose", false, "Print statistics, progress, and some debug info")

Expand Down

0 comments on commit 43721ec

Please sign in to comment.