diff --git a/dist/server/index.cjs b/dist/server/index.cjs index 83dc272..224cf7d 100644 --- a/dist/server/index.cjs +++ b/dist/server/index.cjs @@ -240235,8 +240235,10 @@ var __webpack_exports__ = {}; (() => { const { createApp } = __nccwpck_require__(21968); +console.log('Creating Turbo Cache Server...'); const app = createApp({trustProxy: true}); +console.log(`Starting listening for requests on ${process.env.HOST}:${process.env.PORT}...`); app.listen({ host: process.env.HOST, port: process.env.PORT }, (err) => { if (err) { console.error(err); diff --git a/dist/start/index.js b/dist/start/index.js index 3f4ec59..7c2aa01 100644 --- a/dist/start/index.js +++ b/dist/start/index.js @@ -6096,7 +6096,7 @@ async function main() { [(0,external_node_path_namespaceObject.resolve)(start_dirname, '..', 'start_and_log')], { detached: true, - stdio: 'ignore', + stdio: 'pipe', env: { ...process.env, HOST: host, @@ -6108,8 +6108,9 @@ async function main() { }, ); + subprocess.stdout?.on('data', (data) => (0,core.debug)(data.toString())); + subprocess.stderr?.on('data', (data) => (0,core.debug)(data.toString())); const pid = subprocess.pid?.toString(); - subprocess.unref(); try { (0,core.debug)(`Waiting for port ${port} to be used...`); @@ -6123,8 +6124,10 @@ async function main() { (0,core.exportVariable)('TURBO_API', `http://${host}:${port}`); (0,core.exportVariable)('TURBO_TOKEN', token); (0,core.exportVariable)('TURBO_TEAM', teamId); + + process.exit(0); } catch (e) { - throw new Error(`Turbo server failed to start on port: ${port}`); + throw new Error(`Turbo server failed to start on port: ${port}\n${e}`); } } diff --git a/dist/start_and_log/index.js b/dist/start_and_log/index.js index 5b06969..78e1903 100644 --- a/dist/start_and_log/index.js +++ b/dist/start_and_log/index.js @@ -48,7 +48,7 @@ const readLog = async (name) => { const start_and_log_dirname = (0,external_node_path_namespaceObject.dirname)((0,external_url_namespaceObject.fileURLToPath)(import.meta.url)); -const subprocess = (0,external_node_child_process_namespaceObject.spawn)('node', [(0,external_node_path_namespaceObject.resolve)(start_and_log_dirname, '..', 'server', 'index.cjs')]); - +console.log('Starting Server Process...'); +const subprocess = (0,external_node_child_process_namespaceObject.spawn)('node', [(0,external_node_path_namespaceObject.resolve)(start_and_log_dirname, '..', 'server', 'index.cjs')], {stdio: 'pipe'}); subprocess.stdout.pipe((0,external_node_fs_namespaceObject.createWriteStream)(logFile('out'))); subprocess.stderr.pipe((0,external_node_fs_namespaceObject.createWriteStream)(logFile('err'))); diff --git a/src/server.cjs b/src/server.cjs index 4d57188..13f4d73 100644 --- a/src/server.cjs +++ b/src/server.cjs @@ -1,7 +1,9 @@ const { createApp } = require('turborepo-remote-cache'); +console.log('Creating Turbo Cache Server...'); const app = createApp({trustProxy: true}); +console.log(`Starting listening for requests on ${process.env.HOST}:${process.env.PORT}...`); app.listen({ host: process.env.HOST, port: process.env.PORT }, (err) => { if (err) { console.error(err); diff --git a/src/start.js b/src/start.js index f33788a..19ede76 100644 --- a/src/start.js +++ b/src/start.js @@ -36,7 +36,7 @@ async function main() { [resolve(__dirname, '..', 'start_and_log')], { detached: true, - stdio: 'ignore', + stdio: 'pipe', env: { ...process.env, HOST: host, @@ -48,8 +48,9 @@ async function main() { }, ); + subprocess.stdout?.on('data', (data) => debug(data.toString())); + subprocess.stderr?.on('data', (data) => debug(data.toString())); const pid = subprocess.pid?.toString(); - subprocess.unref(); try { debug(`Waiting for port ${port} to be used...`); @@ -63,8 +64,10 @@ async function main() { exportVariable('TURBO_API', `http://${host}:${port}`); exportVariable('TURBO_TOKEN', token); exportVariable('TURBO_TEAM', teamId); + + process.exit(0); } catch (e) { - throw new Error(`Turbo server failed to start on port: ${port}`); + throw new Error(`Turbo server failed to start on port: ${port}\n${e}`); } } diff --git a/src/start_and_log.js b/src/start_and_log.js index 536dba6..00f551b 100644 --- a/src/start_and_log.js +++ b/src/start_and_log.js @@ -6,7 +6,7 @@ import { logFile } from './logs.js'; const __dirname = dirname(fileURLToPath(import.meta.url)); -const subprocess = spawn('node', [resolve(__dirname, '..', 'server', 'index.cjs')]); - +console.log('Starting Server Process...'); +const subprocess = spawn('node', [resolve(__dirname, '..', 'server', 'index.cjs')], {stdio: 'pipe'}); subprocess.stdout.pipe(createWriteStream(logFile('out'))); subprocess.stderr.pipe(createWriteStream(logFile('err'))); \ No newline at end of file