-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
Bug 🐞 故障Confirmed bugs or reports that are very likely to be bugsConfirmed bugs or reports that are very likely to be bugsFeedback Awaited 🕒 等待反馈Waiting for the feedback from issue creater and issue will be closed if duration is over one monthWaiting for the feedback from issue creater and issue will be closed if duration is over one monthMore Info Needed 🔎 提供详情Further information is requestedFurther information is requested
Description
function runTask(task: TaskType<CustomTask>, isAbort: () => boolean) {
return new Promise<void>((resolve, reject) => {
try {
const thread = threads.start(() => {
eval(task.taskData.content.jsConfig.content);
});
// const execution = engines.execScript(
// task.id,
// task.taskData.content.jsConfig.content,
// );
sleep(2000);
setInterval(() => {
if (isAbort()) {
console.log("任务结束");
thread.interrupt();
// execution.getEngine().forceStop();
resolve();
}
}, 1000);
} catch (e) {
reject(e);
}
});
}
task.taskData.content.jsConfig.content
为js代码,里面有个无限循环
调用thread.interrupt()
后,eval中的代码还在跑。
求大佬解答
Metadata
Metadata
Assignees
Labels
Bug 🐞 故障Confirmed bugs or reports that are very likely to be bugsConfirmed bugs or reports that are very likely to be bugsFeedback Awaited 🕒 等待反馈Waiting for the feedback from issue creater and issue will be closed if duration is over one monthWaiting for the feedback from issue creater and issue will be closed if duration is over one monthMore Info Needed 🔎 提供详情Further information is requestedFurther information is requested