diff options
author | Tim Peters <tim.peters@gmail.com> | 2000-08-20 05:57:36 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2000-08-20 05:57:36 (GMT) |
commit | 84f28db66a5f4ac86d42250b455fc4a1ca7824e3 (patch) | |
tree | 13b2a61694d6d92ab38e2efcd16b02cde3dcf360 | |
parent | 571bb8fc7276a89f90465dfda5fbf1528656bc3e (diff) | |
download | cpython-84f28db66a5f4ac86d42250b455fc4a1ca7824e3.zip cpython-84f28db66a5f4ac86d42250b455fc4a1ca7824e3.tar.gz cpython-84f28db66a5f4ac86d42250b455fc4a1ca7824e3.tar.bz2 |
Changed the popen2.py _test function to use the "more" cmd when
os.name == "nt". This makes test_popen2 pass under Win98SE.
HOWEVER, the Win98 "more" invents a leading newline out
of thin air, and I'm not sure that the other Windows flavors
of "more" also do that.
So, somebody please try under other Windows flavors!
-rw-r--r-- | Lib/popen2.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Lib/popen2.py b/Lib/popen2.py index b20a364..2fd9a19 100644 --- a/Lib/popen2.py +++ b/Lib/popen2.py @@ -140,20 +140,25 @@ else: pass # not yet on unix def _test(): + cmd = "cat" teststr = "abc\n" + resultstr = teststr + if os.name == "nt": + cmd = "more" + resultstr = "\n" + resultstr print "testing popen2..." - r, w = popen2('cat') + r, w = popen2(cmd) w.write(teststr) w.close() - assert r.read() == teststr + assert r.read() == resultstr print "testing popen3..." try: - r, w, e = popen3(['cat']) + r, w, e = popen3([cmd]) except: - r, w, e = popen3('cat') + r, w, e = popen3(cmd) w.write(teststr) w.close() - assert r.read() == teststr + assert r.read() == resultstr assert e.read() == "" for inst in _active[:]: inst.wait() |