On 9/4/07, Mark McLoughlin <markmc(a)redhat.com> wrote:
(status, output) = commands.getstatusoutput("/sbin/dumpe2fs -h
/dev/root")
Not directly related to your discussion, but personally I am fairly
fanatical about never involving /bin/sh in - well, anything if I can avoid
it =) Here it will be fine, but then maybe someone comes along later and
wants to add a user-passed parameter to the command, and then you need to
quote (if it's even remembered, and if it's not then you have weird failures
and in other software security problems).
The "subprocess" module is the fix:
output = subprocess.Popen(['/sbin/dumpe2fs', '-h', '/dev/root'],
stdout=
subprocess.PIPE).communicate()[0]