( args: string[], )
| 30 | } |
| 31 | |
| 32 | export async function execZen( |
| 33 | args: string[], |
| 34 | ): Promise<{ stdout: string; stderr: string }> { |
| 35 | const missingErrors: unknown[] = []; |
| 36 | |
| 37 | for (const candidate of zenCandidates()) { |
| 38 | try { |
| 39 | return await execFileWithClosedStdin(candidate, args); |
| 40 | } catch (err) { |
| 41 | if (!isMissingExecutableError(err)) throw err; |
| 42 | missingErrors.push(err); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | if (missingErrors.length > 0) throw new ZenCliNotFoundError(); |
| 47 | throw new Error("ZenNotes CLI not found"); |
| 48 | } |
| 49 | |
| 50 | function execFileWithClosedStdin( |
| 51 | file: string, |
no test coverage detected