diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-01-02 02:44:28 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-01-02 02:44:28 (GMT) |
commit | de6cde658e321805b5ce84f71cf5bf5c1169dee3 (patch) | |
tree | 3a6c1004a3c8c337d747166c699909b13190040d | |
parent | fc3286b640fe02ef384f14e4554286b5d1897072 (diff) | |
download | cpython-de6cde658e321805b5ce84f71cf5bf5c1169dee3.zip cpython-de6cde658e321805b5ce84f71cf5bf5c1169dee3.tar.gz cpython-de6cde658e321805b5ce84f71cf5bf5c1169dee3.tar.bz2 |
Merged revisions 77222 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77222 | benjamin.peterson | 2010-01-01 20:43:04 -0600 (Fri, 01 Jan 2010) | 1 line
remove use of deprecated os.popen #7619
........
-rw-r--r-- | Lib/imaplib.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/imaplib.py b/Lib/imaplib.py index 0ea307b..78ae45e 100644 --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -22,7 +22,7 @@ Public functions: Internaldate2tuple __version__ = "2.58" -import binascii, os, random, re, socket, sys, time +import binascii, random, re, socket, subprocess, sys, time __all__ = ["IMAP4", "IMAP4_stream", "Internaldate2tuple", "Int2AP", "ParseFlags", "Time2Internaldate"] @@ -1212,7 +1212,7 @@ class IMAP4_stream(IMAP4): Instantiate with: IMAP4_stream(command) - where "command" is a string that can be passed to os.popen2() + where "command" is a string that can be passed to Subprocess.Popen() for more documentation see the docstring of the parent class IMAP4. """ @@ -1232,7 +1232,11 @@ class IMAP4_stream(IMAP4): self.port = None self.sock = None self.file = None - self.writefile, self.readfile = os.popen2(self.command) + self.process = subprocess.Popen(self.command, + stdin=subprocess.PIPE, stdout=subprocess.PIPE, + shell=True, close_fds=True) + self.writefile = self.process.stdin + self.readfile = self.process.stdout def read(self, size): @@ -1255,6 +1259,7 @@ class IMAP4_stream(IMAP4): """Close I/O established in "open".""" self.readfile.close() self.writefile.close() + self.process.wait() |