| 12345678910111213141516171819202122232425262728293031 |
- #!/usr/bin/env node
- 'use strict';
- const path = require('path');
- const { pathToFileURL } = require('url');
- async function main() {
- const moduleUrl = pathToFileURL(path.join(__dirname, '..', 'runtime', 'callback-service', 'src', 'index.mjs')).href;
- const { startRuntime } = await import(moduleUrl);
- const runtime = await startRuntime({
- forceMode: 'enterprise',
- guid: process.argv[2] || '',
- dashboard: false,
- });
- process.stdout.write(`[RelayClient] ESM runtime started. pid=${process.pid}, mode=${runtime.mode}\n`);
- let shuttingDown = false;
- const shutdown = signal => {
- if (shuttingDown) return;
- shuttingDown = true;
- runtime.stop(signal).finally(() => process.exit(0));
- };
- process.once('SIGINT', () => shutdown('SIGINT'));
- process.once('SIGTERM', () => shutdown('SIGTERM'));
- }
- main().catch(error => {
- process.stderr.write(`[RelayClient] ${error.message}\n`);
- process.exit(1);
- });
|