refactor(baoyu-post-to-weibo): add entry point guard to md-to-html.ts

This commit is contained in:
Jim Liu 宝玉 2026-03-11 16:45:56 -05:00
parent a9576ebc67
commit 7b8247544d
1 changed files with 6 additions and 4 deletions

View File

@ -446,7 +446,9 @@ Options:
} }
} }
await main().catch((err) => { if (import.meta.main ?? (process.argv[1] && path.resolve(process.argv[1]) === path.resolve(import.meta.filename ?? ''))) {
console.error(`Error: ${err instanceof Error ? err.message : String(err)}`); await main().catch((err) => {
process.exit(1); console.error(`Error: ${err instanceof Error ? err.message : String(err)}`);
}); process.exit(1);
});
}