Fix TypeError in _spawn(): The argument, args, must be a list (LP: #1443283)
This commit is contained in:
parent
60b46ef6f3
commit
01674e7445
|
@ -543,7 +543,7 @@ class MugshotWindow(Window):
|
|||
"""Handle password prompts from the interactive chfn commands."""
|
||||
# Force the C language for guaranteed english strings in the script.
|
||||
logger.debug('Executing: %s' % command)
|
||||
child = SudoDialog.env_spawn(command, 5)
|
||||
child = SudoDialog.env_spawn(command, [], 5)
|
||||
child.write_to_stdout = True
|
||||
try:
|
||||
child.expect([".*ssword.*", pexpect.EOF])
|
||||
|
|
|
@ -48,7 +48,7 @@ def check_dependencies(commands=[]):
|
|||
return False
|
||||
|
||||
# Check for LANG requirements
|
||||
child = env_spawn('sudo -v', 1)
|
||||
child = env_spawn('sudo', ['-v'], 1)
|
||||
if child.expect([".*ssword.*", "Sorry",
|
||||
pexpect.EOF,
|
||||
pexpect.TIMEOUT]) == 3:
|
||||
|
@ -57,7 +57,7 @@ def check_dependencies(commands=[]):
|
|||
child.close()
|
||||
|
||||
# Check for sudo rights
|
||||
child = env_spawn('sudo -v', 1)
|
||||
child = env_spawn('sudo', ['-v'], 1)
|
||||
try:
|
||||
index = child.expect([".*ssword.*", "Sorry",
|
||||
pexpect.EOF, pexpect.TIMEOUT])
|
||||
|
@ -76,14 +76,14 @@ def check_dependencies(commands=[]):
|
|||
return False
|
||||
|
||||
|
||||
def env_spawn(command, timeout):
|
||||
def env_spawn(command, args, timeout):
|
||||
"""Use pexpect.spawn, adapt for timeout and env requirements."""
|
||||
env = os.environ
|
||||
env["LANG"] = "C"
|
||||
if use_env:
|
||||
child = pexpect.spawn(command, env)
|
||||
child = pexpect.spawn(command, args, env)
|
||||
else:
|
||||
child = pexpect.spawn(command)
|
||||
child = pexpect.spawn(command, args)
|
||||
child.timeout = timeout
|
||||
return child
|
||||
|
||||
|
@ -304,7 +304,7 @@ class SudoDialog(Gtk.Dialog):
|
|||
Return True if successful.
|
||||
'''
|
||||
# Set the pexpect variables and spawn the process.
|
||||
child = env_spawn('sudo /bin/true', 1)
|
||||
child = env_spawn('sudo', ['/bin/true'], 1)
|
||||
try:
|
||||
# Check for password prompt or program exit.
|
||||
child.expect([".*ssword.*", pexpect.EOF])
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-04-11 19:06-0400\n"
|
||||
"POT-Creation-Date: 2018-08-06 05:17-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
Loading…
Reference in New Issue