[lxc-users] Storing output of lxc attach_wait in python variable

Emmanuel Livingstone livingstone.s.e at gmail.com
Sat Jan 28 13:51:46 UTC 2017


Hi all,

I'm using the python bindings of lxc and trying to capture the output of
container.attach_wait(lxc.attach_run_command, ["ls"]) in a variable.
I tried modifying the sys.stdout and sys.stderr to StringIO. But that is
capturing only the output and error printed by python's print statements.
It is not capturing the output of lxc attach though.

One approach is I can call lxc-attach command through subprocess. Is there
any other way I can achieve this while still using lxc python bindings.

Thanks
Livingston
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20170128/ed8023cd/attachment.html>


More information about the lxc-users mailing list