diff --git a/pkg/restic/commands.go b/pkg/restic/commands.go index fd4a83774..fa3c6bee3 100644 --- a/pkg/restic/commands.go +++ b/pkg/restic/commands.go @@ -37,6 +37,7 @@ import ( const ( ResticCMD = "/bin/restic" + BashCMD = "/bin/bash" ) type Snapshot struct { @@ -438,7 +439,7 @@ func (w *ResticWrapper) run(commands ...Command) ([]byte, error) { return nil, err } } - w.sh.Command(cmd.Name, cmd.Args...) + w.sh.Command(BashCMD, "-c", cmd.getCommandAsString()) } out, err := w.sh.Output() if err != nil { @@ -581,3 +582,11 @@ func (w *ResticWrapper) appendInsecureTLSFlag(args []interface{}) []interface{} } return args } + +func (c *Command) getCommandAsString() string { + cmdParts := []string{c.Name} + for _, arg := range c.Args { + cmdParts = append(cmdParts, fmt.Sprintf("%v", arg)) + } + return fmt.Sprintf("`%s`", strings.Join(cmdParts, " ")) +}