← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:sitesearch-testservice-cleanup into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:sitesearch-testservice-cleanup into launchpad:master.

Commit message:
Connect stdin/stdout of site search test service to /dev/null

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/433673

Setting these up as pipes without having anything ever communicate with it, as we previously did, had two disadvantages: it could cause the test service to block if it tries to write too much to stdout, and it caused a `ResourceWarning` due to `proc.stdout` never being explicitly closed.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:sitesearch-testservice-cleanup into launchpad:master.
diff --git a/lib/lp/services/sitesearch/testservice.py b/lib/lp/services/sitesearch/testservice.py
index c602f5d..3a3fb31 100644
--- a/lib/lp/services/sitesearch/testservice.py
+++ b/lib/lp/services/sitesearch/testservice.py
@@ -179,11 +179,10 @@ def start_as_process(service_binary_name):
     # and have fewer things that can go wrong shutting down the process.
     proc = subprocess.Popen(
         script,
-        stdin=subprocess.PIPE,
-        stdout=subprocess.PIPE,
+        stdin=subprocess.DEVNULL,
+        stdout=subprocess.DEVNULL,
         stderr=subprocess.STDOUT,
     )
-    proc.stdin.close()
     return proc