Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support SIGINFO on Darwin #1082

Merged
merged 1 commit into from
Jul 9, 2017
Merged

support SIGINFO on Darwin #1082

merged 1 commit into from
Jul 9, 2017

Conversation

Habbie
Copy link
Contributor

@Habbie Habbie commented Jul 3, 2017

Some OSes, like Darwin and FreeBSD, support a keyboard shortcut (usually ^T, configured via stty) that sends SIGINFO to the running process. Tools like dd, which on Linux give stats when sent SIGUSR1, will give out those stats on receipt of SIGINFO on Darwin and FreeBSD.

This PR adds support for SIGINFO on Darwin to restic. I hope it is correct - it appears the updateProgress channel is not at all reliable in causing a progress update to appear.

This is the first Go I've typed in years, so it is possible I went at this the wrong way. I checked with the #go-nuts IRC channel and I got the impression that build tags are the only way to accomplish this. I do not actually like the way this turned out, so please let me know if I've missed something.

@codecov-io
Copy link

codecov-io commented Jul 3, 2017

Codecov Report

Merging #1082 into master will decrease coverage by 3.54%.
The diff coverage is 62.5%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1082      +/-   ##
==========================================
- Coverage   53.77%   50.22%   -3.55%     
==========================================
  Files         117      118       +1     
  Lines        8925     8933       +8     
==========================================
- Hits         4799     4487     -312     
- Misses       3420     3767     +347     
+ Partials      706      679      -27
Impacted Files Coverage Δ
src/restic/progress_unix.go 57.14% <ø> (ø) ⬆️
src/restic/progress_unix_with_siginfo.go 62.5% <62.5%> (ø)
src/restic/backend/b2/b2.go 0% <0%> (-80.59%) ⬇️
src/restic/backend/swift/swift.go 0% <0%> (-73.69%) ⬇️
src/restic/backend/swift/config.go 36.95% <0%> (-54.35%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 637de01...73cc11f. Read the comment docs.

@fd0
Copy link
Member

fd0 commented Jul 9, 2017

I don't really like the code duplication either, but it's not worth it building a fancy abstraction for such a small detail. Thanks for your contribution!

@fd0 fd0 merged commit 73cc11f into restic:master Jul 9, 2017
fd0 added a commit that referenced this pull request Jul 9, 2017
support SIGINFO on Darwin
@Habbie Habbie deleted the siginfo branch July 10, 2017 11:22
@valpackett
Copy link
Contributor

uhh… you mentioned "Darwin and FreeBSD", that's even mentioned in the release notes (!) but the actual source only mentions darwin!!

This should be enabled on all BSD systems.

@fd0
Copy link
Member

fd0 commented Sep 2, 2017

Hm, I think you're right. Would you like to try a PR to add this? :)

@valpackett
Copy link
Contributor

I thought that's too trivial for a PR but sure

@Habbie
Copy link
Contributor Author

Habbie commented Sep 3, 2017

Yes, sorry, I did not have a FreeBSD box handy when doing the patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants