| 290 | } |
| 291 | |
| 292 | async runAnalysis(execute: Execute, input: CopyInFile) { |
| 293 | const langConfig = this.session.getLang(this.lang); |
| 294 | if (!langConfig.analysis) return; |
| 295 | using span = this.startChildSpan('judge.runAnalysis', { lang: this.lang }); |
| 296 | try { |
| 297 | const r = await runQueued(langConfig.analysis, { |
| 298 | copyIn: { |
| 299 | ...execute.copyIn, |
| 300 | input, |
| 301 | [langConfig.code_file || 'foo']: this.code, |
| 302 | compile: { content: langConfig.compile || '' }, |
| 303 | execute: { content: langConfig.execute || '' }, |
| 304 | }, |
| 305 | env: this.env, |
| 306 | time: 5000, |
| 307 | memory: 256, |
| 308 | }, `analysis[${this.lang}]<${this.rid}>`, 5); |
| 309 | const out = r.stdout.toString(); |
| 310 | if (out.length) this.next({ compilerText: out.substring(0, 1024) }); |
| 311 | if (process.env.DEV) console.log(r); |
| 312 | } catch (e) { |
| 313 | span.recordException(e); |
| 314 | logger.info('Failed to run analysis'); |
| 315 | logger.error(e); |
| 316 | } |
| 317 | } |
| 318 | } |