Merge pull request #476 from Brikaa/fix-v2-endpoint
Fix runtime finding in v2 endpoint
This commit is contained in:
commit
c7bcc7f0b1
|
@ -50,6 +50,7 @@ const SIGNALS = [
|
|||
function get_job(job_info, available_runtimes) {
|
||||
let {
|
||||
language,
|
||||
version,
|
||||
args,
|
||||
stdin,
|
||||
files,
|
||||
|
@ -79,8 +80,10 @@ function get_job(job_info, available_runtimes) {
|
|||
}
|
||||
}
|
||||
|
||||
const rt = available_runtimes.find(rt =>
|
||||
[...rt.aliases, rt.language].includes(rt.language)
|
||||
const rt = available_runtimes.find(
|
||||
rt =>
|
||||
[...rt.aliases, rt.language].includes(language) &&
|
||||
(version === rt.version || version === '*')
|
||||
);
|
||||
|
||||
if (rt === undefined) {
|
||||
|
|
|
@ -43,7 +43,22 @@ expressWs(app);
|
|||
`nix eval --json ${config.flake_path}#pistonRuntimeSets.${config.runtime_set} --apply builtins.attrNames`
|
||||
)
|
||||
.toString();
|
||||
const runtime_names = JSON.parse(runtimes_data);
|
||||
const runtime_names_unordered = JSON.parse(runtimes_data);
|
||||
|
||||
const mainstream_runtimes_data = cp
|
||||
.execSync(
|
||||
`nix eval --json ${config.flake_path}#pistonMainstreamRuntimes`
|
||||
)
|
||||
.toString();
|
||||
const mainstream_runtimes = JSON.parse(mainstream_runtimes_data).filter(runtime =>
|
||||
runtime_names_unordered.includes(runtime)
|
||||
);
|
||||
const runtime_names = [
|
||||
...mainstream_runtimes,
|
||||
...runtime_names_unordered.filter(
|
||||
runtime => !mainstream_runtimes.includes(runtime)
|
||||
),
|
||||
];
|
||||
|
||||
logger.info('Loading the runtimes from the flakes');
|
||||
const runtimes = runtime_names.map(runtime_name => {
|
||||
|
|
|
@ -65,6 +65,13 @@
|
|||
"bash-only" = runtimeList ["bash"];
|
||||
"none" = { };
|
||||
};
|
||||
pistonMainstreamRuntimes = [
|
||||
"mono-csharp"
|
||||
"python3"
|
||||
"node-javascript"
|
||||
"node-typescript"
|
||||
"mono-basic"
|
||||
];
|
||||
|
||||
legacyPackages."${system}" = rec {
|
||||
nosocket = (import ./nosocket { inherit pkgs; }).package;
|
||||
|
|
|
@ -7,6 +7,8 @@ in piston.mkRuntime {
|
|||
|
||||
aliases = [
|
||||
"py2"
|
||||
"python"
|
||||
"py"
|
||||
];
|
||||
|
||||
run = ''
|
||||
|
|
|
@ -8,6 +8,7 @@ in piston.mkRuntime {
|
|||
aliases = [
|
||||
"py3"
|
||||
"py"
|
||||
"python"
|
||||
];
|
||||
|
||||
run = ''
|
||||
|
|
Loading…
Reference in New Issue