On Wed, Feb 18, 2015 at 3:33 PM, Dan Shi <brui...@gmail.com> wrote:
> 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?

Are you sure this is not python issue? Shell redirection seems to work fine

# lxc-attach -n template -- ls -la /blah 2>/tmp/err;echo $?
2

# cat /tmp/err
ls: cannot access /blah: No such file or directory

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

Reply via email to