From 425431aa032e12a025b566ea8250608a6d4fe406 Mon Sep 17 00:00:00 2001 From: Sean Davis Date: Sat, 8 Mar 2014 23:16:54 -0500 Subject: [PATCH] Use env parameter for LANG variable --- mugshot/MugshotWindow.py | 5 +++-- mugshot_lib/SudoDialog.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mugshot/MugshotWindow.py b/mugshot/MugshotWindow.py index 9f5a035..7579986 100644 --- a/mugshot/MugshotWindow.py +++ b/mugshot/MugshotWindow.py @@ -520,7 +520,8 @@ class MugshotWindow(Window): # Full name can only be modified by root. Try using sudo to modify. logger.debug('Attempting to set fullname with sudo chfn') # Force the C language for guaranteed english strings in the script. - child = pexpect.spawn('LANG=C %s %s %s' % (sudo, chfn, username)) + child = pexpect.spawn('%s %s %s' % (sudo, chfn, username), + env={"LANG": "C"}) child.timeout = 5 try: child.expect([".*ssword.*", pexpect.EOF]) @@ -541,7 +542,7 @@ class MugshotWindow(Window): return_codes.append(child.exitstatus) logger.debug('Attempting to set user details with chfn') - child = pexpect.spawn('LANG=C %s' % chfn) + child = pexpect.spawn(chfn, env={"LANG": "C"}) child.timeout = 5 try: child.expect([".*ssword.*", pexpect.EOF]) diff --git a/mugshot_lib/SudoDialog.py b/mugshot_lib/SudoDialog.py index 5f9c113..3de0bf6 100644 --- a/mugshot_lib/SudoDialog.py +++ b/mugshot_lib/SudoDialog.py @@ -216,7 +216,7 @@ class SudoDialog(Gtk.MessageDialog): Return True if successful. ''' # Set the pexpect variables and spawn the process. - child = pexpect.spawn('LANG=C sudo /bin/true') + child = pexpect.spawn('sudo /bin/true', env={"LANG": "C"}) child.timeout = 1 try: # Check for password prompt or program exit.