joewalnes / websocketd

Turn any program that uses STDIN/STDOUT into a WebSocket server. Like inetd, but for WebSockets.

Home Page:http://websocketd.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bash script running on websocketd can't connect to dbus

baoheping opened this issue · comments

In my bash script i called a command fcitx5-remote for switching input method, the command needs connect to dbus for calling fcitx5 interface. Then when i run this script in websocketd services, it's reporting error 'what(): Failed to create dbus connection' in log. When printing dbus environment variables in the script, it's all empty.

So is there a solution make enable commands running on websocketd could connect to dbus.

You say "environment variable sin the script, it's all empty". Have you looked at the --passenv option?

I know nothing about dbus, but many things get confused if their expected environment variables are absent.

--passenv does not work for CGI scripts (for websocket processes it works as expected). This appears to be unintentional, as the code to make it work is written except only missing this trivial fix: matvore@cd87527

Thanks to @PerMildner , after --passenv DBUS_SESSION_BUS_ADDRESS,XDG_RUNTIME_DIR, it's working fine.