MCPcopy
hub / github.com/alibaba/lightproxy / startProcess

Function startProcess

src/main/api.ts:56–93  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54};
55require(decodeURIComponent('${modulePath}'));`;
56 const startProcess = () => {
57 const child = spwan(
58 nodeExe,
59 [
60 '-e',
61 `const code = decodeURIComponent("${encodeURIComponent(nodeScript)}");console.log(code);eval(code);`,
62 '--tls-min-v1.0',
63 '--max-http-header-size=256000',
64 '--http-parser=legacy',
65 ],
66 {
67 env: {
68 ...process.env,
69 ...env,
70 ELECTRON_RUN_MODULE: moduleId,
71 LIGHTPROXY_BOARDCASR_PORT: boardcastPort,
72 USER_DATA: app.getPath('appData'),
73 NODE_PATH: nodeModulePath,
74 ELECTRON_RUN_AS_NODE: 1,
75 NODE_SKIP_PLATFORM_CHECK: 1,
76 },
77 },
78 );
79
80 exitHook(() => {
81 child?.kill();
82 });
83
84 child?.stderr?.on('data', data => {
85 logger.error(`[pid ${child.pid}]stderr: ${data.toString()}`);
86 });
87
88 child?.stdout?.on('data', data => {
89 logger.info(`[pid ${child.pid}]stdout: ${data.toString()}`);
90 });
91
92 return child.pid;
93 };
94
95 return startProcess();
96}

Callers 1

spawnModuleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected