flex-launcher
flex-launcher copied to clipboard
Flex Launcher modifies locale environment variables for launched applications
So I have a terminal launched from Flex Launcher for debugging and I kept getting errors from perl on launch about improper locale settings, namely LANG=en
I'm on Arch and it's a fresh install, en_US.UTF-8
>>> cat /etc/locale.conf
LANG=en_US.UTF-8
If I re-source that locale conf or just export LANG=en_US.UTF-8 the problem is resolved for that terminal session.
If I SSH into the machine or launch the terminal using rofi, the LANG environment variable is properly set to en_US.UTF-8
I'm not sure how this issue would present in other applications but figured this was an unintentional bug that should be reported
Flex Launcher doesn't modify the LANG environment variable. It could be SDL, but I doubt it.
I suspect that the environment variables are not being transferred to the new child process. Currently the POSIX function execvp is used to execute the child processes. execve may be a better choice because it allows the caller to specify an array of environment variables. I can look into this later to confirm whether or not this is the cause of the issue.
There's execvpe that has all the flags too. I thiiiink you always want to inherit the environment variables. What a mystery what's causing the change.
I'm working around this in a pythong script (the script is for autoswitching resolution between apps and flex-launcher):
env = dict(os.environ)
env["LANG"] = "en_US.UTF-8"
subprocess.run(cmd, shell=True, env=env)