From 73cc11f000114d78a80b150ee155432121784fc8 Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Mon, 3 Jul 2017 20:39:42 +0200 Subject: [PATCH] support SIGINFO on Darwin --- src/restic/progress_unix.go | 2 +- src/restic/progress_unix_with_siginfo.go | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/restic/progress_unix_with_siginfo.go diff --git a/src/restic/progress_unix.go b/src/restic/progress_unix.go index 3726f77e6..d93a491ca 100644 --- a/src/restic/progress_unix.go +++ b/src/restic/progress_unix.go @@ -1,4 +1,4 @@ -// +build !windows +// +build !windows,!darwin package restic diff --git a/src/restic/progress_unix_with_siginfo.go b/src/restic/progress_unix_with_siginfo.go new file mode 100644 index 000000000..ffed4b89a --- /dev/null +++ b/src/restic/progress_unix_with_siginfo.go @@ -0,0 +1,23 @@ +// +build darwin + +package restic + +import ( + "os" + "os/signal" + "syscall" + + "restic/debug" +) + +func init() { + c := make(chan os.Signal) + signal.Notify(c, syscall.SIGUSR1) + signal.Notify(c, syscall.SIGINFO) + go func() { + for s := range c { + debug.Log("Signal received: %v\n", s) + forceUpdateProgress <- true + } + }() +}