diff --git a/mugshot/MugshotWindow.py b/mugshot/MugshotWindow.py index 690488e..1b26129 100644 --- a/mugshot/MugshotWindow.py +++ b/mugshot/MugshotWindow.py @@ -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]) diff --git a/mugshot_lib/SudoDialog.py b/mugshot_lib/SudoDialog.py index d304152..2eeffe6 100644 --- a/mugshot_lib/SudoDialog.py +++ b/mugshot_lib/SudoDialog.py @@ -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]) diff --git a/po/mugshot.pot b/po/mugshot.pot index c740658..cce1783 100644 --- a/po/mugshot.pot +++ b/po/mugshot.pot @@ -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 \n" "Language-Team: LANGUAGE \n"