mpdas icon indicating copy to clipboard operation
mpdas copied to clipboard

Fails only when run by systemd

Open doronbehar opened this issue 4 years ago • 1 comments

I'm getting this error:

mpdas[4887]: terminate called after throwing an instance of 'std::logic_error'
mpdas[4887]:   what():  basic_string::_M_construct null not valid

Only when I run mpdas inside a systemd service. But when I run it manually I don't get it :/

Any idea how to debug this? Google didn't help much...

doronbehar avatar Apr 29 '20 11:04 doronbehar

Hey @hrkfdn,

I think the problem is this line:

https://github.com/hrkfdn/mpdas/blob/c81c480a6081af104c70c3574fb71319ff1521b7/main.cpp#L103

main.cpp assumes this environmental variable is set, while it isn't set in system-wide systemd services. Hence the fix that worked for me was to add:

[Service]
Environment="HOME=/home/doron"

To my mpdas.service.

doronbehar avatar May 16 '20 16:05 doronbehar