client/tests: don't do dup2() dance to pass file descriptor to "tools/test-cloud-meta-mock.py"
"preexec_fn" is not great, because it is not generally safe in multi threaded code (and we don't know whether the test didn't start other threads already, like a GDBus worker thread). Well, it probably is safe, if you only call async signal safe code, but it's not clear what os.dup2() does under the hood. Just avoid that. We can pass on the FD directly.
This commit is contained in:
@@ -68,11 +68,9 @@ class SocketHTTPServer(HTTPServer):
|
||||
|
||||
|
||||
# See sd_listen_fds(3)
|
||||
fileno = os.getenv("LISTEN_FDS")
|
||||
fileno = os.getenv("LISTEN_FD")
|
||||
if fileno is not None:
|
||||
if fileno != "1":
|
||||
raise Exception("Bad LISTEN_FDS")
|
||||
s = socket.socket(fileno=3)
|
||||
s = socket.socket(fileno=int(fileno))
|
||||
else:
|
||||
addr = ("localhost", 0)
|
||||
s = socket.socket()
|
||||
|
Reference in New Issue
Block a user