MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / postProcess

Method postProcess

lib/compilers/nim.ts:95–118  ·  view source on GitHub ↗
(
        result: CompilationResult,
        outputFilename: string,
        filters: ParseFiltersAndOutputOptions,
    )

Source from the content-addressed store, hash-verified

93 }
94
95 override async postProcess(
96 result: CompilationResult,
97 outputFilename: string,
98 filters: ParseFiltersAndOutputOptions,
99 ) {
100 const options = result.compilationOptions;
101 const cacheDir = this.cacheDir(outputFilename);
102 try {
103 if (_.intersection(options!, ['js', 'check', '-c']).length > 0) filters.binary = false;
104 else {
105 filters.binary = true;
106 const objFile = unwrap(this.getCacheFile(options!, result.inputFilename!, cacheDir));
107 if (await utils.fileExists(objFile)) {
108 await fs.rename(objFile, outputFilename);
109 } else {
110 result.code = 1;
111 result.stderr.push({text: 'Compiler did not generate a file'});
112 }
113 }
114 return super.postProcess(result, outputFilename, filters);
115 } finally {
116 await fs.rm(cacheDir, {recursive: true, force: true});
117 }
118 }
119
120 override getSharedLibraryPathsAsArguments(/*libraries*/) {
121 return [];

Calls 5

cacheDirMethod · 0.95
getCacheFileMethod · 0.95
fileExistsMethod · 0.80
pushMethod · 0.80
unwrapFunction · 0.50

Tested by

no test coverage detected