Fix order of args and stdin

This commit is contained in:
Vrganj 2021-01-16 18:52:18 +01:00
parent c537cab2da
commit ea54716774
2 changed files with 2 additions and 2 deletions

View File

@ -56,7 +56,7 @@ app.post(
language.aliases.includes(req.body.language.toLowerCase()) language.aliases.includes(req.body.language.toLowerCase())
); );
const { stdout, stderr, output, ran } = await execute(language, req.body.source, req.body.args, req.body.stdin); const { stdout, stderr, output, ran } = await execute(language, req.body.source, req.body.stdin, req.body.args);
res.status(200).json({ res.status(200).json({
ran, ran,

View File

@ -1,7 +1,7 @@
const { writeFile } = require('fs/promises'); const { writeFile } = require('fs/promises');
const { spawn } = require('child_process'); const { spawn } = require('child_process');
function execute(language, source, args, stdin) { function execute(language, source, stdin, args) {
return new Promise(async resolve => { return new Promise(async resolve => {
const stamp = new Date().getTime(); const stamp = new Date().getTime();
const sourceFile = `/tmp/${stamp}.code`; const sourceFile = `/tmp/${stamp}.code`;