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

sx doesn't kill while loops #22

Open
handow23 opened this issue Jul 5, 2021 · 3 comments
Open

sx doesn't kill while loops #22

handow23 opened this issue Jul 5, 2021 · 3 comments

Comments

@handow23
Copy link

handow23 commented Jul 5, 2021

sx doesn't kill while loops inside sxrc or external scripts.

example:

# Statusbar loop
while true; do
   xsetroot -name "$( date +"%F %R" )"
   sleep 1m    # Update time every minute
done &

when I exit my WM (dwm) xsetroot says it can't open display 1 every minute. this issue doesn't happen on xinit.

--

distro: void linux
ver: 2.1.6

@Earnestly
Copy link
Owner

This would be the responsibility of your script.

Any background processes when the parent exits, unless it is cleaned up, will be orphaned and reaped by PID 1 (or a subreaper).

You could fix this by installing a trap handler which kills the entire process group upon exiting, e.g.:

trap 'kill 0' EXIT

@handow23
Copy link
Author

handow23 commented Jul 6, 2021

where should I put the handler? moreover, dbus is complaining about being unable to spawn a command:

Error connecting: Error spawning command line “dbus-launch --autolaunch=616ef277b96d7a69d1faa96a5f567df0 --binary-syntax --close-stderr”: Child process exited with code 1

Autolaunch error: X11 initialization failed.

@Earnestly
Copy link
Owner

The trap would be placed in your sxrc (as with any process sx starts (see bernstein chains)).

The dbus issues are unrelated and likely occur due to the lack of a DBUS_SESSION_BUS_ADDRESS environment. However as dbus-launch is deprecated, could you try dbus-run-session instead?
If you need to set the environment it usually takes the form of DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus but this may differ on runit based inits.

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

2 participants