aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-04-12 04:48:07 +0200
committerMattias Andrée <maandree@operamail.com>2014-04-12 04:48:07 +0200
commit4747787be28985df225c7053f4593d581de0f774 (patch)
tree47bdc8a54a7bbd5b3b2142474b190ff283a07a7e
parentm (diff)
downloadnightshift-4747787be28985df225c7053f4593d581de0f774.tar.gz
nightshift-4747787be28985df225c7053f4593d581de0f774.tar.bz2
nightshift-4747787be28985df225c7053f4593d581de0f774.tar.xz
ensure that redshift is running without locale settings
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rwxr-xr-xsrc/nightshift.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nightshift.py b/src/nightshift.py
index 7992311..1df25f8 100755
--- a/src/nightshift.py
+++ b/src/nightshift.py
@@ -138,7 +138,7 @@ for arg in sys.argv[1:]:
elif arg in ('-V', '--version', '-version'):
## Print the version of nightshift and of redshift
print('%s %s' % (PROGRAM_NAME, PROGRAM_VERSION))
- Popen(['redshift', '-V'], stdout = sys.stdout).wait()
+ Popen(['redshift', '-V'], stdout = sys.stdout, env = redshift_env).wait()
sys.exit(0)
elif arg in ('-C', '--copyright', '-copyright'):
## Print copyright information
@@ -230,7 +230,7 @@ for opt in ('-l', '-m'):
arg = red_opts[i]
if (arg == 'list') or ('help' in arg.split(':')):
proc = ['redshift', opt, arg]
- proc = Popen(proc, stdout = sys.stdout, stderr = sys.stderr)
+ proc = Popen(proc, stdout = sys.stdout, stderr = sys.stderr, env = redshift_env)
proc.wait()
sys.exit(proc.returncode)
# Translate single-parameter -t into dual-parameter -t
@@ -258,6 +258,12 @@ red_status, red_running = True, True
red_condition = None
+## Create locale free environment for redshift
+redshift_env = os.environ.copy()
+for var in ('LANG', 'LANGUAGE', 'LC_ALL', 'LC_MESSAGES'):
+ redshift_env[var] = 'C'
+
+
def read_status(proc, sock):
'''
Read status from redshift