Make ran field do something
This commit is contained in:
parent
f685bdc751
commit
8fd831982e
|
@ -49,10 +49,10 @@ app.post(
|
|||
language.aliases.includes(req.body.language.toLowerCase())
|
||||
);
|
||||
|
||||
const { stdout, stderr, output } = await execute(language, req.body.source, req.body.args);
|
||||
const { stdout, stderr, output, ran } = await execute(language, req.body.source, req.body.args);
|
||||
|
||||
res.status(200).json({
|
||||
ran: true,
|
||||
ran,
|
||||
language: language.name,
|
||||
version: language.version,
|
||||
stdout,
|
||||
|
|
|
@ -28,12 +28,17 @@ function execute(language, source, args) {
|
|||
output += chunk;
|
||||
});
|
||||
|
||||
process.on('exit', () => {
|
||||
process.on('exit', code => {
|
||||
stderr = stderr.trim().substring(0, 65535);
|
||||
stdout = stdout.trim().substring(0, 65535);
|
||||
output = output.trim().substring(0, 65535);
|
||||
|
||||
resolve({ stdout, stderr, output });
|
||||
resolve({
|
||||
stdout,
|
||||
stderr,
|
||||
output,
|
||||
ran: code === 0,
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue