def sudoify_command_list(command_list): ask = config.get_global('Sudo', 'ask') == 'True' if ask: password = get_password() else: password = config.get_global('Sudo', 'password') command_list = ['echo',password,'|','sudo','-S'] +command_list return command_list
def sudoify_command_str(command_string): ask = config.get_global('Sudo', 'ask') == 'True' if ask: password = get_password() else: password = config.get_global('Sudo', 'password') command_string = ('echo %s | sudo -S %s' % (password, command_string)) return command_string