tmux-MacOSX-pasteboard icon indicating copy to clipboard operation
tmux-MacOSX-pasteboard copied to clipboard

Wrapping pbcopy causes hang on MacOS Sierra 10.12

Open fatmcgav opened this issue 8 years ago • 3 comments

Observed whilst attempting to use Python Openstack client.

It would appear that installing the reattach-to-user-namespace bottle with the --with-wrap-pbcopy-and-pbpaste causes the Openstack client to hang.

An example of the stack trace is here, with the relevant line highlighted. Running pbcopy -help on the CLI also results in a hang.

Running the system pbcopy directly works. E.g.:

/usr/bin/pbcopy -help 2017-02-24 14:58:32.265 pbcopy[12486:7664884] Usage: pbcopy [-help]

Thoughts?

fatmcgav avatar Feb 24 '17 14:02 fatmcgav

I think this is a problematic interaction between the Homebred-supplied pbcopy script and your use of command-line arguments.

Based on this, it looks like Homebrew’s wrapped pbcopy does not pass command line arguments to the actual pbcopy (it also has a useless-use-of-cat). So when you run this wrapper script as pbcopy -help it ignores your -help, and ends up just waiting to read something on its stdin (it is actually the useless cat doing the reading/blocking here, but pbcopy would behave identically given that it would not have been given a command line argument that would cause its immediate exit).

If you arrange for its stdin to be /dev/null (or a pipe that is closed from the opposite end, et cetera), then it will return quickly (although it will also clobber the pasteboard with an empty string). Arguably though, Homebrew should probably fix those pbcopy and pbpaste scripts to pass along arguments (and drop the useless cat, which would still trip up your pbcopy -help use case unless you provide an empty stdin).

ChrisJohnsen avatar Feb 24 '17 20:02 ChrisJohnsen

@ChrisJohnsen Yeh, that aligns with my tests whereby not wrapping the pbcopy/pbpaste commands fixes the hang.

Are you responsible for the Homebrew formula, or should I bug it separately over there?

Cheers

fatmcgav avatar Feb 24 '17 22:02 fatmcgav

I do not use Homebrew; I am not sure how best to get it changed there.

ChrisJohnsen avatar Feb 24 '17 23:02 ChrisJohnsen