[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lxc-users
Subject:    [lxc-users] Storing output of lxc attach_wait in python variable
From:       Emmanuel Livingstone <livingstone.s.e () gmail ! com>
Date:       2017-01-28 13:51:46
Message-ID: CAGsiBmUtuMgGierBdZVPPYami_Vf-OODf9OcM8dGvwMqQELDWw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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

[Attachment #5 (text/html)]

<div dir="ltr">Hi all,<div><br></div><div>I&#39;m using the python bindings of lxc \
and trying to capture the output of container.attach_wait(lxc.attach_run_command, \
[&quot;ls&quot;]) in a variable.</div><div>I tried modifying the sys.stdout and \
sys.stderr to StringIO. But that is capturing only the output and error printed by \
python&#39;s print statements. It is not capturing the output of lxc attach \
though.</div><div><br></div><div>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.</div><div><br></div><div>Thanks</div><div>Livingston</div></div>


[Attachment #6 (text/plain)]

_______________________________________________
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic