mirror of
https://github.com/octoleo/restic.git
synced 2024-11-22 04:45:15 +00:00
Extend SnapshotOptions w/ command data
In order to determine whether to save a snapshot, we need to capture the exit code returned by a command. In order to provide a nice error message, we supply stderr as well. Signed-off-by: Sebastian Hoß <seb@xn--ho-hia.de>
This commit is contained in:
parent
a2b76ff34f
commit
25350a9c55
@ -676,6 +676,8 @@ func runBackup(ctx context.Context, opts BackupOptions, gopts GlobalOptions, ter
|
||||
Hostname: opts.Host,
|
||||
ParentSnapshot: parentSnapshot,
|
||||
ProgramVersion: "restic " + version,
|
||||
Command: command,
|
||||
CommandStderr: stderr,
|
||||
}
|
||||
|
||||
if !gopts.JSON {
|
||||
|
@ -2,7 +2,9 @@ package archiver
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"runtime"
|
||||
"sort"
|
||||
@ -681,6 +683,8 @@ type SnapshotOptions struct {
|
||||
Time time.Time
|
||||
ParentSnapshot *restic.Snapshot
|
||||
ProgramVersion string
|
||||
Command *exec.Cmd
|
||||
CommandStderr io.ReadCloser
|
||||
}
|
||||
|
||||
// loadParentTree loads a tree referenced by snapshot id. If id is null, nil is returned.
|
||||
|
Loading…
Reference in New Issue
Block a user