Fix order of args and stdin
This commit is contained in:
parent
c537cab2da
commit
ea54716774
|
@ -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,
|
||||||
|
|
|
@ -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`;
|
||||||
|
|
Loading…
Reference in New Issue