()
| 176 | } |
| 177 | |
| 178 | async function main() { |
| 179 | const parsed = parseArgs(process.argv.slice(2)); |
| 180 | if (parsed.help) { |
| 181 | printUsage(); |
| 182 | return; |
| 183 | } |
| 184 | |
| 185 | const options = resolveInstanceOptions(parseInstanceArgs(parsed.instanceArgs)); |
| 186 | // Validate the profile root we own before the reaper scans/removes anything in |
| 187 | // it, so a hijacked root aborts the run loudly instead of being trusted. |
| 188 | await ensureSecureDir(options.profileRoot); |
| 189 | await reapStaleInstances(options); |
| 190 | await ensureObsidianInstance(options); |
| 191 | process.exitCode = await spawnObsidian(options, parsed.commandArgs); |
| 192 | } |
| 193 | |
| 194 | if (import.meta.url === `file://${process.argv[1]}`) { |
| 195 | main().catch((error) => { |
no test coverage detected