feat: add task hooks

This commit is contained in:
Peifan Li
2025-12-30 22:25:25 -05:00
parent 6f1a1cd12f
commit 8ac9e99450
13 changed files with 221 additions and 13 deletions

View File

@@ -58,7 +58,15 @@ export class HookService {
if (context.thumbnailPath) env.MYTUBE_THUMBNAIL_PATH = context.thumbnailPath;
if (context.error) env.MYTUBE_ERROR = context.error;
await execPromise(`bash "${hookPath}"`, { env });
const { stdout, stderr } = await execPromise(`bash "${hookPath}"`, { env });
if (stdout && stdout.trim()) {
logger.info(`[HookService] ${eventName} stdout: ${stdout.trim()}`);
}
if (stderr && stderr.trim()) {
logger.warn(`[HookService] ${eventName} stderr: ${stderr.trim()}`);
}
logger.info(`[HookService] Hook ${eventName} executed successfully.`);
} catch (error: any) {
logger.error(