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

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: c85cf87e4ba3ba0c6d50e97fe500a3f11583481f
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:sitesearch-testservice-cleanup
Merge into: launchpad:master
Diff against target: 16 lines (+2/-3)
1 file modified
lib/lp/services/sitesearch/testservice.py (+2/-3)
Reviewer Review Type Date Requested Status
Andrey Fedoseev (community) Approve
Review via email: mp+433673@code.launchpad.net

Commit message

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

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Andrey Fedoseev (andrey-fedoseev) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/services/sitesearch/testservice.py b/lib/lp/services/sitesearch/testservice.py
2index c602f5d..3a3fb31 100644
3--- a/lib/lp/services/sitesearch/testservice.py
4+++ b/lib/lp/services/sitesearch/testservice.py
5@@ -179,11 +179,10 @@ def start_as_process(service_binary_name):
6 # and have fewer things that can go wrong shutting down the process.
7 proc = subprocess.Popen(
8 script,
9- stdin=subprocess.PIPE,
10- stdout=subprocess.PIPE,
11+ stdin=subprocess.DEVNULL,
12+ stdout=subprocess.DEVNULL,
13 stderr=subprocess.STDOUT,
14 )
15- proc.stdin.close()
16 return proc
17
18

Subscribers

People subscribed via source and target branches

to status/vote changes: