119
124
class DebconfCommunicator(Debconf, object):
120
125
def __init__(self, owner, title=None, cloexec=False):
121
self.dccomm = popen2.Popen3(['debconf-communicate', '-fnoninteractive',
126
args = ['debconf-communicate', '-fnoninteractive', owner]
128
self.dccomm = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)
129
read = self.dccomm.stdout
130
write = self.dccomm.stdin
132
self.dccomm = popen2.Popen3(args)
133
read = self.dccomm.fromchild
134
write = self.dccomm.tochild
123
135
super(DebconfCommunicator, self).__init__(title=title,
124
read=self.dccomm.fromchild,
125
write=self.dccomm.tochild)
127
139
fcntl.fcntl(self.read.fileno(), fcntl.F_SETFD, fcntl.FD_CLOEXEC)
128
140
fcntl.fcntl(self.write.fileno(), fcntl.F_SETFD, fcntl.FD_CLOEXEC)
130
142
def shutdown(self):
131
143
if self.dccomm is not None:
132
self.dccomm.tochild.close()
133
self.dccomm.fromchild.close()
145
self.dccomm.stdin.close()
146
self.dccomm.stdout.close()
148
self.dccomm.tochild.close()
149
self.dccomm.fromchild.close()
134
150
self.dccomm.wait()
135
151
self.dccomm = None