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

run.sh should kill any previously existing golden processes #1

Open
indeedwatson opened this issue Feb 1, 2020 · 5 comments
Open

Comments

@indeedwatson
Copy link

If you have run.sh in your bspwmrc and you reload bspwm a new run.sh and run.py processes will start. I found myself yesterday inadvertedly with around 25 run.sh and run.py processes in the background, which I had to kill one by one because I didn't know how to perform a killall on them.

So run.sh should have a way to kill any previous process before it starts, much like you have for sxhkd in your example.

@sumeet
Copy link
Owner

sumeet commented Feb 6, 2020

Hey cool, I didn't know anyone was using this 🙂

Can you give the latest version a try? This should take care of killing off the child processes.

@indeedwatson
Copy link
Author

indeedwatson commented Feb 6, 2020

I found this script on the bspwm subreddit and been using it since.

Reading the stackoverflow thread it seems the trap part is to kill processes once the script is exited, but there's a problem:

If you execute run.sh in bspwmrc, when you restart bspwm the process is simply spawned again. So any child processes from the first script don't get killed because the first script itself just keeps running.

You can easily try it yourself, just do bspc wm -r (mod + alt + r in my case) and then search htop for golden. You should see two run.sh and two golden.py. Restart bspwm again and you will see three, etc.

I submitted a PR with my own implementation, I don't know if it's totally correct but so far it seems to work fine. Please read the commit message and see how you feel about it.

@sumeet
Copy link
Owner

sumeet commented Feb 6, 2020 via email

@indeedwatson
Copy link
Author

What’s the best way to repro through normal usage? Are you killing and
relaunching bspwm manually, or using a bspc command to do it?

You were quick to reply. See the edit I made:

You can easily try it yourself, just do bspc wm -r (mod + alt + r in my case) and then search htop for golden. You should see two run.sh and two golden.py. Restart bspwm again and you will see three, etc.

@slingamn
Copy link

Couple initial impressions:

  1. Can you eliminate the while-true loop in run.sh? Is it just for resilience to crashes?
  2. golden.py should ideally exit when bspwm exits --- I think preferably it would detect that its stdin is closed. Is this already happening and being covered up by the while-true loop? Or is there some issue in the Python code where it doesn't detect this as expected? Or am I just misunderstanding the relationship between bspc subscribe and golden.py?

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

3 participants