bugaevc / wl-clipboard

Command-line copy/paste utilities for Wayland
GNU General Public License v3.0
1.62k stars 59 forks source link

Use wait(p)id instead of wait #156

Closed remexre closed 1 year ago

remexre commented 1 year ago

When using a script that execs into wl-copy, I occasionally get a fairly-reproducible race, where a child from the script exits, causing one of the wait()s to continue early, typically leading to cat: /tmp/wl-copy-buffer-u0QbEf/stdin: No such file or directory or not being able to paste anything later on.

Reproduction with execline: execlineb -Pc "pipeline { foreground { sleep 1 } echo test } wl-copy -f"

bugaevc commented 1 year ago

Hm, so do I understand it right that you're creating children of wl-copy that it itself doesn't know anything about, by means of spawning child processes before exec'ing wl-copy?

That's an interesting use-case I haven't thought about; and indeed wait(p)id should work to support it.