Close devnull filehandle

This commit is contained in:
Cory Wright 2010-12-20 18:15:40 -05:00
parent 63d9378bcc
commit 1b47ef95ff

View File

@ -17,8 +17,8 @@
# under the License. # under the License.
""" """
This script is used to configure iptables, ebtables, and arptables rules for This script is used to configure iptables, ebtables, and arptables rules on
XenServer instances. XenServer hosts.
""" """
import os import os
@ -55,6 +55,7 @@ def execute(command, return_stdout=False):
devnull = open(os.devnull, 'w') devnull = open(os.devnull, 'w')
proc = subprocess.Popen(command, shell=True, close_fds=True, proc = subprocess.Popen(command, shell=True, close_fds=True,
stdout=subprocess.PIPE, stderr=devnull) stdout=subprocess.PIPE, stderr=devnull)
devnull.close()
if return_stdout: if return_stdout:
return proc.stdout.read() return proc.stdout.read()
else: else: