Skip to content

Commit

Permalink
Add Cmd method to expose the underlying exec.Cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
bougou committed Aug 12, 2023
1 parent 49956be commit 2ee1a8c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ func (r Rsync) Run() error {
return r.cmd.Wait()
}

func (r Rsync) Cmd() *exec.Cmd {
return r.cmd
}

// NewRsync returns task with described options
func NewRsync(source, destination string, options RsyncOptions) *Rsync {
arguments := append(getArguments(options), source, destination)
Expand Down
5 changes: 5 additions & 0 deletions task.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"bytes"
"io"
"math"
"os/exec"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -79,6 +80,10 @@ func (t *Task) Run() error {
return err
}

func (r Task) Cmd() *exec.Cmd {
return r.rsync.cmd
}

// NewTask returns new rsync task
func NewTask(source, destination string, rsyncOptions RsyncOptions) *Task {
// Force set required options
Expand Down

0 comments on commit 2ee1a8c

Please sign in to comment.