Skip to content

Commit

Permalink
dev: allow specifying runtime version
Browse files Browse the repository at this point in the history
  • Loading branch information
KernelDeimos committed Jan 28, 2025
1 parent c852a28 commit 1dad2e8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/backend/src/modules/puterexec/Judge0Service.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ class Judge0Service extends BaseService {
if ( runtime.startsWith('j0-') ) {
return runtime.slice(3);
}
if ( runtime.includes('-') ) {
const versionIndex = runtime.lastIndexOf('-');
const langPart = runtime.slice(0, versionIndex);
const versionPart = runtime.slice(versionIndex + 1);
const lang = this.languages.find((lang) =>
lang.language === langPart && lang.version === versionPart
);
if ( lang ) {
return lang.judge0_id;
}
}
let lang = this.languages.find((lang) => lang.language === runtime);
if ( lang ) {
return lang.judge0_id;
Expand Down

0 comments on commit 1dad2e8

Please sign in to comment.