Use env parameter for LANG variable
This commit is contained in:
parent
75fe0acd1d
commit
425431aa03
|
@ -520,7 +520,8 @@ class MugshotWindow(Window):
|
||||||
# Full name can only be modified by root. Try using sudo to modify.
|
# Full name can only be modified by root. Try using sudo to modify.
|
||||||
logger.debug('Attempting to set fullname with sudo chfn')
|
logger.debug('Attempting to set fullname with sudo chfn')
|
||||||
# Force the C language for guaranteed english strings in the script.
|
# 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
|
child.timeout = 5
|
||||||
try:
|
try:
|
||||||
child.expect([".*ssword.*", pexpect.EOF])
|
child.expect([".*ssword.*", pexpect.EOF])
|
||||||
|
@ -541,7 +542,7 @@ class MugshotWindow(Window):
|
||||||
return_codes.append(child.exitstatus)
|
return_codes.append(child.exitstatus)
|
||||||
|
|
||||||
logger.debug('Attempting to set user details with chfn')
|
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
|
child.timeout = 5
|
||||||
try:
|
try:
|
||||||
child.expect([".*ssword.*", pexpect.EOF])
|
child.expect([".*ssword.*", pexpect.EOF])
|
||||||
|
|
|
@ -216,7 +216,7 @@ class SudoDialog(Gtk.MessageDialog):
|
||||||
Return True if successful.
|
Return True if successful.
|
||||||
'''
|
'''
|
||||||
# Set the pexpect variables and spawn the process.
|
# 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
|
child.timeout = 1
|
||||||
try:
|
try:
|
||||||
# Check for password prompt or program exit.
|
# Check for password prompt or program exit.
|
||||||
|
|
Loading…
Reference in New Issue