final dev

This commit is contained in:
2026-03-11 12:09:49 +00:00
parent 2cf523b8e3
commit 5e6ec13c06

View File

@@ -521,7 +521,8 @@ class ScriptService {
const controlState = { const controlState = {
cancelRequested: false, cancelRequested: false,
cancelReason: null, cancelReason: null,
child: null child: null,
cancelSignalSent: false
}; };
runtimeActivityService.setControls(activityId, { runtimeActivityService.setControls(activityId, {
cancel: async (payload = {}) => { cancel: async (payload = {}) => {
@@ -535,7 +536,7 @@ class ScriptService {
}); });
if (controlState.child) { if (controlState.child) {
// User cancel should stop instantly. // User cancel should stop instantly.
killChildProcessTree(controlState.child, 'SIGKILL'); controlState.cancelSignalSent = killChildProcessTree(controlState.child, 'SIGKILL') || controlState.cancelSignalSent;
} }
return { accepted: true, message: 'Abbruch angefordert.' }; return { accepted: true, message: 'Abbruch angefordert.' };
} }
@@ -552,7 +553,8 @@ class ScriptService {
}); });
const exitCode = Number.isFinite(Number(run.code)) ? Number(run.code) : null; const exitCode = Number.isFinite(Number(run.code)) ? Number(run.code) : null;
const finishedSuccessfully = exitCode === 0 && !run.timedOut; const finishedSuccessfully = exitCode === 0 && !run.timedOut;
const cancelledByUser = Boolean(controlState.cancelRequested) && !finishedSuccessfully; const cancelledByUser = Boolean(controlState.cancelRequested)
&& (Boolean(controlState.cancelSignalSent) || !finishedSuccessfully);
const success = finishedSuccessfully; const success = finishedSuccessfully;
const message = cancelledByUser const message = cancelledByUser
? (controlState.cancelReason || 'Von Benutzer abgebrochen') ? (controlState.cancelReason || 'Von Benutzer abgebrochen')