From feaa47b5777886e57335a5ee20f3e736d7ba0151 Mon Sep 17 00:00:00 2001 From: Ajay Kongara Date: Fri, 4 Nov 2022 12:05:27 -0700 Subject: [PATCH] Send the port on which the server was opened back to the parent process, if this process was opened with an IPC channel. --- src/bin/firebase-functions.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bin/firebase-functions.ts b/src/bin/firebase-functions.ts index 83d131282..3d75cbdce 100644 --- a/src/bin/firebase-functions.ts +++ b/src/bin/firebase-functions.ts @@ -78,4 +78,9 @@ if (process.env.PORT) { } console.log("Serving at port", port); -server = app.listen(port); +server = app.listen(port, () => { + const address = server.address(); + if (process.send && typeof address === "object") { + process.send(address.port); + } +});