mirror of https://github.com/restic/restic.git
Honor RESTIC_PROGRESS_FPS env variable on non-interactive terminals
This makes it possible to use the environment variable to also get regular progress updates on non-interactive terminals.
This commit is contained in:
parent
13ce981794
commit
969141b5e9
|
@ -16,16 +16,14 @@ func newProgressMax(show bool, max uint64, description string) *progress.Counter
|
||||||
}
|
}
|
||||||
|
|
||||||
interval := time.Second / 60
|
interval := time.Second / 60
|
||||||
if !stdoutIsTerminal() {
|
fps, err := strconv.ParseInt(os.Getenv("RESTIC_PROGRESS_FPS"), 10, 64)
|
||||||
interval = 0
|
if err == nil && fps >= 1 {
|
||||||
} else {
|
if fps > 60 {
|
||||||
fps, err := strconv.ParseInt(os.Getenv("RESTIC_PROGRESS_FPS"), 10, 64)
|
fps = 60
|
||||||
if err == nil && fps >= 1 {
|
|
||||||
if fps > 60 {
|
|
||||||
fps = 60
|
|
||||||
}
|
|
||||||
interval = time.Second / time.Duration(fps)
|
|
||||||
}
|
}
|
||||||
|
interval = time.Second / time.Duration(fps)
|
||||||
|
} else if !stdoutIsTerminal() {
|
||||||
|
interval = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
return progress.New(interval, func(v uint64, d time.Duration, final bool) {
|
return progress.New(interval, func(v uint64, d time.Duration, final bool) {
|
||||||
|
|
Loading…
Reference in New Issue