[lxc-users] What's the best way to get stderr from lxc-attach when running a command?

Dan Shi bruingo at gmail.com
Wed Feb 18 08:33:14 UTC 2015


I'm trying to run some command in container through lxc-attach. The script
is in python 2.7. Apparently, command like following does not raise a
subprocess exception:
subprocess.check_output('lxc-attach -n c1 -- ls non_exist_dir')

One way to get the stderr from the ls command running in container could be
using -o option to direct the stderr to a local log file, then parse the
log file to see any errors. It's not really a clean solution. I'm wondering
if there is a better way to do this?

Thanks,
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20150218/4619426d/attachment.html>


More information about the lxc-users mailing list