mirror of
https://github.com/octoleo/restic.git
synced 2024-12-26 20:30:19 +00:00
rclone: Return one fewer value from run
This commit is contained in:
parent
fa3eed1998
commit
950b818274
@ -36,12 +36,12 @@ type Backend struct {
|
||||
}
|
||||
|
||||
// run starts command with args and initializes the StdioConn.
|
||||
func run(command string, args ...string) (*StdioConn, *exec.Cmd, *sync.WaitGroup, func() error, error) {
|
||||
func run(command string, args ...string) (*StdioConn, *sync.WaitGroup, func() error, error) {
|
||||
cmd := exec.Command(command, args...)
|
||||
|
||||
p, err := cmd.StderrPipe()
|
||||
if err != nil {
|
||||
return nil, nil, nil, nil, err
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
var wg sync.WaitGroup
|
||||
@ -58,7 +58,7 @@ func run(command string, args ...string) (*StdioConn, *exec.Cmd, *sync.WaitGroup
|
||||
|
||||
r, stdin, err := os.Pipe()
|
||||
if err != nil {
|
||||
return nil, nil, nil, nil, err
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
stdout, w, err := os.Pipe()
|
||||
@ -66,7 +66,7 @@ func run(command string, args ...string) (*StdioConn, *exec.Cmd, *sync.WaitGroup
|
||||
// close first pipe and ignore subsequent errors
|
||||
_ = r.Close()
|
||||
_ = stdin.Close()
|
||||
return nil, nil, nil, nil, err
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
cmd.Stdin = r
|
||||
@ -84,7 +84,7 @@ func run(command string, args ...string) (*StdioConn, *exec.Cmd, *sync.WaitGroup
|
||||
err = errW
|
||||
}
|
||||
if err != nil {
|
||||
return nil, nil, nil, nil, err
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
c := &StdioConn{
|
||||
@ -93,7 +93,7 @@ func run(command string, args ...string) (*StdioConn, *exec.Cmd, *sync.WaitGroup
|
||||
cmd: cmd,
|
||||
}
|
||||
|
||||
return c, cmd, &wg, bg, nil
|
||||
return c, &wg, bg, nil
|
||||
}
|
||||
|
||||
// wrappedConn adds bandwidth limiting capabilities to the StdioConn by
|
||||
@ -157,7 +157,7 @@ func newBackend(cfg Config, lim limiter.Limiter) (*Backend, error) {
|
||||
arg0, args := args[0], args[1:]
|
||||
|
||||
debug.Log("running command: %v %v", arg0, args)
|
||||
stdioConn, cmd, wg, bg, err := run(arg0, args...)
|
||||
stdioConn, wg, bg, err := run(arg0, args...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -181,6 +181,7 @@ func newBackend(cfg Config, lim limiter.Limiter) (*Backend, error) {
|
||||
},
|
||||
}
|
||||
|
||||
cmd := stdioConn.cmd
|
||||
waitCh := make(chan struct{})
|
||||
be := &Backend{
|
||||
tr: tr,
|
||||
|
Loading…
Reference in New Issue
Block a user