mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
Make actions work with Python3
This commit is contained in:
parent
e7ed0c7c58
commit
ea3d72175d
@ -133,8 +133,9 @@ def _run(action, options=None, async=False, run_as_root=False):
|
||||
# contract: 3C, 3D: don't allow users to insert escape characters in
|
||||
# options
|
||||
if options:
|
||||
if not hasattr(options, "__iter__"):
|
||||
if not isinstance(options, (list, tuple)):
|
||||
options = [options]
|
||||
|
||||
cmd += [pipes.quote(option) for option in options]
|
||||
|
||||
# contract 1: commands can run via sudo.
|
||||
@ -153,6 +154,7 @@ def _run(action, options=None, async=False, run_as_root=False):
|
||||
|
||||
if not async:
|
||||
output, error = proc.communicate()
|
||||
output, error = output.decode(), error.decode()
|
||||
if proc.returncode != 0:
|
||||
LOGGER.error('Error executing command - %s, %s, %s', cmd, output,
|
||||
error)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user