mirror of
https://github.com/restic/restic.git
synced 2026-02-03 04:20:45 -05:00
drop warnf
This commit is contained in:
parent
7d5ebdd0b3
commit
f71278138f
3 changed files with 6 additions and 11 deletions
|
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
|
@ -23,7 +24,8 @@ func createGlobalContext() context.Context {
|
|||
func cleanupHandler(c <-chan os.Signal, cancel context.CancelFunc) {
|
||||
s := <-c
|
||||
debug.Log("signal %v received, cleaning up", s)
|
||||
Warnf("\rsignal %v received, cleaning up \n", s)
|
||||
// ignore error as there's no good way to handle it
|
||||
_, _ = fmt.Fprintf(os.Stderr, "\rsignal %v received, cleaning up \n", s)
|
||||
|
||||
if val, _ := os.LookupEnv("RESTIC_DEBUG_STACKTRACE_SIGINT"); val != "" {
|
||||
_, _ = os.Stderr.WriteString("\n--- STACKTRACE START ---\n\n")
|
||||
|
|
|
|||
|
|
@ -197,15 +197,6 @@ func collectBackends() *location.Registry {
|
|||
return backends
|
||||
}
|
||||
|
||||
// Warnf writes the message to the configured stderr stream.
|
||||
func Warnf(format string, args ...interface{}) {
|
||||
_, err := fmt.Fprintf(globalOptions.stderr, format, args...)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "unable to write to stderr: %v\n", err)
|
||||
}
|
||||
debug.Log(format, args...)
|
||||
}
|
||||
|
||||
// resolvePassword determines the password to be used for opening the repository.
|
||||
func resolvePassword(opts *GlobalOptions, envStr string) (string, error) {
|
||||
if opts.PasswordFile != "" && opts.PasswordCommand != "" {
|
||||
|
|
|
|||
|
|
@ -141,7 +141,9 @@ func printExitError(code int, message string) {
|
|||
|
||||
err := json.NewEncoder(globalOptions.stderr).Encode(jsonS)
|
||||
if err != nil {
|
||||
Warnf("JSON encode failed: %v\n", err)
|
||||
// ignore error as there's no good way to handle it
|
||||
_, _ = fmt.Fprintf(os.Stderr, "JSON encode failed: %v\n", err)
|
||||
debug.Log("JSON encode failed: %v\n", err)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue