MCPcopy
hub / github.com/compiler-explorer/compiler-explorer / processLeanCOutput

Method processLeanCOutput

lib/base-compiler.ts:1753–1770  ·  view source on GitHub ↗
(
        outputFilename: string,
        output: CompilationResult,
        options?: {['clang-format']: boolean} | null,
    )

Source from the content-addressed store, hash-verified

1751 }
1752
1753 async processLeanCOutput(
1754 outputFilename: string,
1755 output: CompilationResult,
1756 options?: {['clang-format']: boolean} | null,
1757 ): Promise<ResultLine[]> {
1758 if (output.code !== 0) {
1759 return [{text: 'Failed to run compiler to get Lean C output'}];
1760 }
1761 const outpath = this.getLeanCOutputFilename(outputFilename);
1762 if (await utils.fileExists(outpath)) {
1763 let content = await fs.readFile(outpath, 'utf8');
1764 if (options?.['clang-format']) {
1765 content = await this.applyClangFormat(content);
1766 }
1767 return content.split('\n').map(line => ({text: line}));
1768 }
1769 return [{text: 'Internal error; unable to open output path'}];
1770 }
1771
1772 async processYulOutput(
1773 defaultOutputFilename: string,

Callers 1

doCompilationMethod · 0.95

Calls 4

applyClangFormatMethod · 0.95
fileExistsMethod · 0.80
readFileMethod · 0.80

Tested by

no test coverage detected