ret = stdout.channel.recv_exit_status()
output = list()
for line in stdout.read().splitlines():
- output.append(line)
+ output.append(line.decode('utf-8'))
if ret:
if self.log:
self.log.debug("*** FAILED to run command %s (%s)" % (command, ret))
elif method == 'get':
ftp.get(source, dest)
ftp.close()
+
+def run_async(func):
+ from threading import Thread
+ from functools import wraps
+
+ @wraps(func)
+ def async_func(*args, **kwargs):
+ thread = Thread(target=func, args=args, kwargs=kwargs)
+ thread.start()
+ return thread
+
+ return async_func