return output of command execution as string instead of bytestring

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2011-10-12 17:12:22 +02:00
commit a254e1f31e
4 changed files with 6 additions and 6 deletions

View file

@ -104,7 +104,7 @@ class Remote(object):
assert isinstance(command, (list, tuple)), "list or tuple argument expected, got: %s" % command
self.log.debug("Remote run: %s", command)
try:
return subprocess.check_output(command, env=env)
return subprocess.check_output(command, env=env).decode()
except subprocess.CalledProcessError:
raise cdist.Error("Command failed: " + " ".join(command))
except OSError as error:
@ -125,7 +125,7 @@ class Remote(object):
self.log.debug("Remote run script env: %s", env)
try:
return subprocess.check_output(command, env=env)
return subprocess.check_output(command, env=env).decode()
except subprocess.CalledProcessError as error:
script_content = self.run(["cat", script])
self.log.error("Code that raised the error:\n%s", script_content)