27 lines
721 B
TypeScript
27 lines
721 B
TypeScript
import { fork } from 'node:child_process';
|
|
import path from 'node:path';
|
|
|
|
const runCmd = () => {
|
|
const filePath = path.resolve(process.cwd(), 'agent/npc.ts');
|
|
const child = fork(filePath, {
|
|
env: {
|
|
...process.env,
|
|
// CNB_COMMENT_BODY: '@kevisual/cnb(router) 我的kevisual/cnb的issues列表',
|
|
CNB_COMMENT_BODY: '关闭仓库的issue。kevisual/cnb/-/issues/5',
|
|
CNB_ISSUE_ID: '6',
|
|
CNB_ISSUE_TITLE: '托尔斯泰',
|
|
CNB_REPO_SLUG: 'kevisual/cnb',
|
|
},
|
|
stdio: 'inherit',
|
|
});
|
|
|
|
child.on('error', (err) => {
|
|
console.error('Error in child process:', err);
|
|
});
|
|
|
|
child.on('exit', (code) => {
|
|
console.log(`Child process exited with code ${code}`);
|
|
});
|
|
}
|
|
|
|
runCmd(); |