mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-29 10:10:19 +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
|
# contract: 3C, 3D: don't allow users to insert escape characters in
|
||||||
# options
|
# options
|
||||||
if options:
|
if options:
|
||||||
if not hasattr(options, "__iter__"):
|
if not isinstance(options, (list, tuple)):
|
||||||
options = [options]
|
options = [options]
|
||||||
|
|
||||||
cmd += [pipes.quote(option) for option in options]
|
cmd += [pipes.quote(option) for option in options]
|
||||||
|
|
||||||
# contract 1: commands can run via sudo.
|
# 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:
|
if not async:
|
||||||
output, error = proc.communicate()
|
output, error = proc.communicate()
|
||||||
|
output, error = output.decode(), error.decode()
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
LOGGER.error('Error executing command - %s, %s, %s', cmd, output,
|
LOGGER.error('Error executing command - %s, %s, %s', cmd, output,
|
||||||
error)
|
error)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user