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

clipboard cleared on exit #986

Closed
jsbronder opened this issue Jan 22, 2020 · 1 comment
Closed

clipboard cleared on exit #986

jsbronder opened this issue Jan 22, 2020 · 1 comment

Comments

@jsbronder
Copy link

jsbronder commented Jan 22, 2020

I frequently launch tig in order to copy a sha [1] and then exit with the intent of pasting it on the command line with shift+insert. This stopped working a while ago and I finally got around to bisecting it to this commit, ccbda97. This is surprising to me as I'd expect (and a cursory read of src/io.c appears to confirm) that tig would fairly quickly cleanup any launched shell command on exit.

Note that prior to exiting tig the clipboard does indeed contain the sha I intend to copy. It's only cleared when I exit tig.

This is relatively important to me so I'll happily keep digging as time permits but any guidance would be helpful.

  1. In ~/.tigrc
bind generic Y !@sh -c 'echo -n %(commit) | xclip -selection primary'
@jsbronder
Copy link
Author

Ok, I get it. From the xclip man page:

The default action is to silently wait in the background for X selection requests (pastes) until another X application places data in the clipboard, at which point xclip exits silently.

So this makes complete sense and corrects my understanding of how xclip actually works. However, it's probably not what people following the wiki will expect. On Linux systems I'd suggest that using atexit and killing the entire process group is a pretty massive hammer when PR_SET_PDEATHSIG is available, but I can see why it was used for simplicity and simplicity.

The quickest "fix" is to probably just update the documentation to call xclip with setsid which will put the xclip daemon in a new session, and hence, process group.

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

No branches or pull requests

1 participant