codereview: use cmd.communicate.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4145046
diff --git a/lib/codereview/codereview.py b/lib/codereview/codereview.py
index 94270f8..96efc85 100644
--- a/lib/codereview/codereview.py
+++ b/lib/codereview/codereview.py
@@ -1146,10 +1146,8 @@
 	except:
 		return "hgpatch: " + ExceptionDetail()
 
-	cmd.stdin.write(patch)
-	cmd.stdin.close()
-	out = cmd.stdout.read()
-	if cmd.wait() != 0 and not opts["ignore_hgpatch_failure"]:
+	out, err = cmd.communicate(patch)
+	if cmd.returncode != 0 and not opts["ignore_hgpatch_failure"]:
 		return "hgpatch failed"
 	cl.local = True
 	cl.files = out.strip().split()