mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 14:22:04 +08:00
bisync: change exit code from 2 to 7 for critically aborted run
This commit is contained in:
parent
a849fd59f0
commit
3dec664a19
|
@ -20,6 +20,7 @@ import (
|
||||||
"github.com/rclone/rclone/fs/config"
|
"github.com/rclone/rclone/fs/config"
|
||||||
"github.com/rclone/rclone/fs/config/flags"
|
"github.com/rclone/rclone/fs/config/flags"
|
||||||
"github.com/rclone/rclone/fs/filter"
|
"github.com/rclone/rclone/fs/filter"
|
||||||
|
"github.com/rclone/rclone/fs/fserrors"
|
||||||
"github.com/rclone/rclone/fs/hash"
|
"github.com/rclone/rclone/fs/hash"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -193,7 +194,7 @@ var commandDefinition = &cobra.Command{
|
||||||
cmd.Run(false, true, command, func() error {
|
cmd.Run(false, true, command, func() error {
|
||||||
err := Bisync(ctx, fs1, fs2, &opt)
|
err := Bisync(ctx, fs1, fs2, &opt)
|
||||||
if err == ErrBisyncAborted {
|
if err == ErrBisyncAborted {
|
||||||
os.Exit(2)
|
return fserrors.FatalError(err)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
"github.com/rclone/rclone/lib/terminal"
|
"github.com/rclone/rclone/lib/terminal"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrBisyncAborted signals that bisync is aborted and forces exit code 2
|
// ErrBisyncAborted signals that bisync is aborted and forces non-zero exit code
|
||||||
var ErrBisyncAborted = errors.New("bisync aborted")
|
var ErrBisyncAborted = errors.New("bisync aborted")
|
||||||
|
|
||||||
// bisyncRun keeps bisync runtime state
|
// bisyncRun keeps bisync runtime state
|
||||||
|
|
|
@ -968,12 +968,15 @@ that while concurrent bisync runs are allowed, _be very cautious_
|
||||||
that there is no overlap in the trees being synched between concurrent runs,
|
that there is no overlap in the trees being synched between concurrent runs,
|
||||||
lest there be replicated files, deleted files and general mayhem.
|
lest there be replicated files, deleted files and general mayhem.
|
||||||
|
|
||||||
### Return codes
|
### Exit codes
|
||||||
|
|
||||||
`rclone bisync` returns the following codes to calling program:
|
`rclone bisync` returns the following codes to calling program:
|
||||||
- `0` on a successful run,
|
- `0` on a successful run,
|
||||||
- `1` for a non-critical failing run (a rerun may be successful),
|
- `1` for a non-critical failing run (a rerun may be successful),
|
||||||
- `2` for a critically aborted run (requires a `--resync` to recover).
|
- `2` on syntax or usage error,
|
||||||
|
- `7` for a critically aborted run (requires a `--resync` to recover).
|
||||||
|
|
||||||
|
See also the section about [exit codes](/docs/#exit-code) in main docs.
|
||||||
|
|
||||||
### Graceful Shutdown
|
### Graceful Shutdown
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user