MCPcopy Index your code
hub / github.com/Serverless-Devs/Serverless-Devs / execDaemon

Function execDaemon

src/exec-daemon.ts:7–26  ·  view source on GitHub ↗
(filename: string, config: Record<string, any> = {})

Source from the content-addressed store, hash-verified

5import { getYamlContent, getRootHome } from '@serverless-devs/utils';
6
7function execDaemon(filename: string, config: Record<string, any> = {}) {
8 // 测试环境不上报
9 if (process.env.NODE_ENV === 'test') return;
10 // set analysis+
11 const data = getYamlContent(path.join(getRootHome(), 'set-config.yml'));
12 if (data?.analysis === 'disable' && filename === 'report.js') return;
13 const filePath = path.join(__dirname, 'daemon', filename);
14 if (!fs.existsSync(filePath)) return;
15 if (process.env['serverless_devs_daemon_enable'] === 'false') {
16 logger.info(`It is detected that the environment variable 'serverless_devs_daemon_enable' is false and the daemon: ${filePath} will run in the main process`);
17 return spawn(process.execPath, [filePath, JSON.stringify(config)], {
18 stdio: 'inherit',
19 });
20 }
21
22 return spawn(process.execPath, [filePath, JSON.stringify(config)], {
23 detached: true,
24 stdio: 'ignore',
25 }).unref();
26}
27
28export default execDaemon;

Callers 9

initMethod · 0.85
initMethod · 0.85
getAliMenuMethod · 0.85
doActionFunction · 0.85
execComponentFunction · 0.85
initMethod · 0.85
updateComponentMethod · 0.85
doExecCommandMethod · 0.85
doOneErrorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected