fix: preserve task logs and refine editor controls

This commit is contained in:
whyour committed 2026-11-21 01:11:44 +08:00
1 parent 4b3c31c0a7
commit a65d56a980
10 files changed
+356 -49

No files matched your search

+2 -1
View File
@@ -7,7 +7,7 @@ import type { Readable } from 'stream';
// A managed command waits on its parent's pipe. EOF before authorization exits
// without interpreting the command, even when the worker is killed by SIGKILL.
export function spawnCronCommand(command: string, triggerId?: string, onCommandStart?: (at: number) => void) {
export function spawnCronCommand(command: string, triggerId?: string, onCommandStart?: (at: number) => void, outputPath?: string) {
if (!triggerId) return spawn(command, { shell: '/bin/bash' });
const sourceScript = join(__dirname, '../../shell/cron-command.py');
const supervisor = existsSync(sourceScript) ? sourceScript : join(process.env.QL_DIR!, 'shell/cron-command.py');
@@ -15,6 +15,7 @@ export function spawnCronCommand(command: string, triggerId?: string, onCommandS
receiptPath(triggerId) || '', process.execPath, join(__dirname, 'managedExit.cjs'),
];
if (onCommandStart) args.push('report-start');
if (outputPath) args.push('log-output', outputPath);
const child = spawn('python3', args, { env: { ...process.env, QL_TRIGGER_ID: triggerId },
stdio: onCommandStart ? ['pipe', 'pipe', 'pipe', 'pipe'] : 'pipe' }) as ChildProcessWithoutNullStreams;
if (onCommandStart && child.stdio[3]) {