cdown / clipmenu

Clipboard management using dmenu
MIT License
1.14k stars 91 forks source link

clipmenud: prevent spawning more clipnotify jobs #172

Closed mehw closed 3 years ago

mehw commented 3 years ago

Hello,

While clipmenud is running, each time clipctl enable is executed another clipnotify job is spawn...

This bug is how I found out the need of #171 (fix to properly kill children jobs).

$ clipmenud &
...
$ ps -e | grep clipnotify
7382 pts/1   00:00:00 clipnotify
$ clipctl enable
...
$ ps -e | grep clipnotify
7382 pts/1   00:00:00 clipnotify
7395 pts/1   00:00:00 clipnotify

There's a problem in the main loop, which is easily fixable... When a signal is trapped, the wait "$_CM_CLIPNOTIFY_PID" breaks, and the loop restarts, spawning another clipnotify job because the previous one was not killed by sig_enable...

On the other hand, sig_disable kills the current clipnotify job before restarting the loop... We need to do the same for sig_enable.

Thanks.

cdown commented 3 years ago

I'll look at this later, thanks.

cdown commented 3 years ago

Thanks for reporting! This is indeed a bug, thanks for the fix. :-)

mehw commented 3 years ago

Thanks for merging ;)