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."""
|
"""Handle password prompts from the interactive chfn commands."""
|
||||||
# Force the C language for guaranteed english strings in the script.
|
# Force the C language for guaranteed english strings in the script.
|
||||||
logger.debug('Executing: %s' % command)
|
logger.debug('Executing: %s' % command)
|
||||||
child = SudoDialog.env_spawn(command, 5)
|
child = SudoDialog.env_spawn(command, [], 5)
|
||||||
child.write_to_stdout = True
|
child.write_to_stdout = True
|
||||||
try:
|
try:
|
||||||
child.expect([".*ssword.*", pexpect.EOF])
|
child.expect([".*ssword.*", pexpect.EOF])
|
||||||
|
|
|
@ -48,7 +48,7 @@ def check_dependencies(commands=[]):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Check for LANG requirements
|
# Check for LANG requirements
|
||||||
child = env_spawn('sudo -v', 1)
|
child = env_spawn('sudo', ['-v'], 1)
|
||||||
if child.expect([".*ssword.*", "Sorry",
|
if child.expect([".*ssword.*", "Sorry",
|
||||||
pexpect.EOF,
|
pexpect.EOF,
|
||||||
pexpect.TIMEOUT]) == 3:
|
pexpect.TIMEOUT]) == 3:
|
||||||
|
@ -57,7 +57,7 @@ def check_dependencies(commands=[]):
|
||||||
child.close()
|
child.close()
|
||||||
|
|
||||||
# Check for sudo rights
|
# Check for sudo rights
|
||||||
child = env_spawn('sudo -v', 1)
|
child = env_spawn('sudo', ['-v'], 1)
|
||||||
try:
|
try:
|
||||||
index = child.expect([".*ssword.*", "Sorry",
|
index = child.expect([".*ssword.*", "Sorry",
|
||||||
pexpect.EOF, pexpect.TIMEOUT])
|
pexpect.EOF, pexpect.TIMEOUT])
|
||||||
|
@ -76,14 +76,14 @@ def check_dependencies(commands=[]):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def env_spawn(command, timeout):
|
def env_spawn(command, args, timeout):
|
||||||
"""Use pexpect.spawn, adapt for timeout and env requirements."""
|
"""Use pexpect.spawn, adapt for timeout and env requirements."""
|
||||||
env = os.environ
|
env = os.environ
|
||||||
env["LANG"] = "C"
|
env["LANG"] = "C"
|
||||||
if use_env:
|
if use_env:
|
||||||
child = pexpect.spawn(command, env)
|
child = pexpect.spawn(command, args, env)
|
||||||
else:
|
else:
|
||||||
child = pexpect.spawn(command)
|
child = pexpect.spawn(command, args)
|
||||||
child.timeout = timeout
|
child.timeout = timeout
|
||||||
return child
|
return child
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ class SudoDialog(Gtk.Dialog):
|
||||||
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 = env_spawn('sudo /bin/true', 1)
|
child = env_spawn('sudo', ['/bin/true'], 1)
|
||||||
try:
|
try:
|
||||||
# Check for password prompt or program exit.
|
# Check for password prompt or program exit.
|
||||||
child.expect([".*ssword.*", pexpect.EOF])
|
child.expect([".*ssword.*", pexpect.EOF])
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
Loading…
Reference in New Issue