修改退出进程逻辑

This commit is contained in:
whyour committed 2022-12-05 15:26:22 +08:00
1 parent 23fd595582
commit b95fb9cda4
10 files changed
+76 -125

No files matched your search

+5 -6
View File
@@ -44,12 +44,11 @@ export default class ScheduleService {
async runTask(command: string, callbacks: TaskCallbacks = {}) {
return new Promise(async (resolve, reject) => {
const startTime = dayjs();
await callbacks.onBefore?.(startTime);
const cp = spawn(command, { shell: '/bin/bash' });
try {
const startTime = dayjs();
await callbacks.onBefore?.(startTime);
const cp = spawn(command, { shell: '/bin/bash' });
// TODO:
callbacks.onStart?.(cp, startTime);
@@ -100,8 +99,8 @@ export default class ScheduleService {
error,
);
await callbacks.onError?.(JSON.stringify(error));
resolve(null);
}
resolve(cp.pid);
});
}