]> granicus.if.org Git - python/commitdiff
Fix the second reincarnation of SF #456395 -- failure on IRIX. This
authorGuido van Rossum <guido@python.org>
Tue, 11 Sep 2001 14:24:35 +0000 (14:24 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 11 Sep 2001 14:24:35 +0000 (14:24 +0000)
time use .replace() to change all \r\n into \n, not just the last one.

Lib/test/test_pty.py

index 7d72b763efa447b524146179f22aa48e068173f8..204ff56922a69bdb8b3fa7b71102b4daf3e9e495 100644 (file)
@@ -34,17 +34,13 @@ if not os.isatty(slave_fd):
 debug("Writing to slave_fd")
 os.write(slave_fd, TEST_STRING_1)
 s1 = os.read(master_fd, 1024)
-if s1[-2:] == "\r\n":
-    s1 = s1[:-2] + "\n"
-sys.stdout.write(s1)
+sys.stdout.write(s1.replace("\r\n", "\n"))
 
 debug("Writing chunked output")
 os.write(slave_fd, TEST_STRING_2[:5])
 os.write(slave_fd, TEST_STRING_2[5:])
 s2 = os.read(master_fd, 1024)
-if s2[-2:] == "\r\n":
-    s2 = s2[:-2] + "\n"
-sys.stdout.write(s2)
+sys.stdout.write(s2.replace("\r\n", "\n"))
 
 os.close(slave_fd)
 os.close(master_fd)