question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Copy (xclip backend) hangs when called in side shell command substitution

See original GitHub issue

Hello,

OS: Debian unstable linux-amd64 Pyperclip 1.6.0 Backend in use: xclip Shell: zsh, dash

pyperclip.copy() hangs when called inside shell’s command substitution. When xclip executes, python process is gone while xclip stays up running. But it seems to be Python3-ony problem, Python2 is fine.

$ python3 --version
Python 3.6.4
$  echo "$(python3 -c 'import pyperclip; pyperclip.copy("foo")'; echo "foo")"
<hangs> ...
$ pgrep python
$ pgrep xclip
5659
Python 2.7.14+
$ echo "$(python2 -c 'import pyperclip; pyperclip.copy("foo")'; echo "foo")"
foo
$

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
modaxcommented, Jan 26, 2018

Well, it seems that xclip is kind of broken in general when used in pipes. E.g. this one hangs as well:

echo "$(echo "foo" | xclip -selection clipboard)"

Could you make xsel preferred over xclip?

0reactions
FluorineDogcommented, Apr 13, 2019

Installing xsel solves my headache. Maybe make it an explicit dependency better?

Read more comments on GitHub >

github_iconTop Results From Across the Web

xclip hangs shell-command - Emacs Stack Exchange
xclip has to "hang" around to own the clipboard, as X uses asynchronous clipboards which belong to a process. You should be able...
Read more >
Highest scored 'xclip' questions - Stack Overflow
Python script using subprocess and xclip hangs if piped in bash ... Byobu with screen backend: Connect copy buffer to system clipboard.
Read more >
My 10 Linux and UNIX Command Line Mistakes - nixCraft
My top 10 Linux / Unix command line mistakes that cause some sort of downtime on my server/cluster. Try to avoid them. Learn...
Read more >
Mastering Eshell - Mastering Emacs
Eshell is a shell written entirely in Emacs Lisp, and it replicates most of the features and commands from GNU CoreUtils and the...
Read more >
Command Line Options - Valve Developer Community
Linux shell scripts pointing to the application with launch options. executable -command. Examples. steam.exe -applaunch 280 -dev -console -sw +sv_lan 1 + ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found