From 9d7fb1fb0edeee596c7b42e46f286bfe7a2e8af5 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 15 Dec 2023 17:15:58 +0100 Subject: [PATCH] Use a constant for the notification file descriptor --- dist/index.js | 8 ++++---- src/index.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dist/index.js b/dist/index.js index ca60af0..9fe91b1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -12181,11 +12181,12 @@ async function setUpAutoCache() { else { runEnv = process.env; } - // Start the server. + // Start the server. Once it is ready, it will notify us via file descriptor 3. const outputPath = `${daemonDir}/daemon.log`; const output = openSync(outputPath, 'a'); + const notifyFd = 3; const daemon = spawn(daemonBin, [ - '--notify-fd', '3', + '--notify-fd', String(notifyFd), '--listen', coreExports.getInput('listen'), '--upstream', coreExports.getInput('upstream-cache'), '--diagnostic-endpoint', coreExports.getInput('diagnostic-endpoint'), @@ -12205,7 +12206,7 @@ async function setUpAutoCache() { const pidFile = path$1.join(daemonDir, 'daemon.pid'); await fs$2.writeFile(pidFile, `${daemon.pid}`); await new Promise((resolve, reject) => { - daemon.stdio[3].on('data', (data) => { + daemon.stdio[notifyFd].on('data', (data) => { if (data.toString().trim() == 'INIT') { resolve(); } @@ -12233,7 +12234,6 @@ async function notifyAutoCache() { return; } try { - // FIXME: remove this coreExports.debug(`Indicating workflow start`); const res = await gotClient.post(`http://${coreExports.getInput('listen')}/api/workflow-start`).json(); coreExports.debug(`back from post`); diff --git a/src/index.ts b/src/index.ts index 5aad26d..79ade61 100644 --- a/src/index.ts +++ b/src/index.ts @@ -113,13 +113,14 @@ async function setUpAutoCache() { runEnv = process.env; } - // Start the server. + // Start the server. Once it is ready, it will notify us via file descriptor 3. const outputPath = `${daemonDir}/daemon.log`; const output = openSync(outputPath, 'a'); + const notifyFd = 3; const daemon = spawn( daemonBin, [ - '--notify-fd', '3', + '--notify-fd', String(notifyFd), '--listen', core.getInput('listen'), '--upstream', core.getInput('upstream-cache'), '--diagnostic-endpoint', core.getInput('diagnostic-endpoint'), @@ -145,7 +146,7 @@ async function setUpAutoCache() { await fs.writeFile(pidFile, `${daemon.pid}`); await new Promise((resolve, reject) => { - daemon.stdio[3].on('data', (data) => { + daemon.stdio[notifyFd].on('data', (data) => { if (data.toString().trim() == 'INIT') { resolve(); } @@ -177,7 +178,6 @@ async function notifyAutoCache() { } try { - // FIXME: remove this core.debug(`Indicating workflow start`); const res: any = await gotClient.post(`http://${core.getInput('listen')}/api/workflow-start`).json(); core.debug(`back from post`);