mirror of
https://github.com/engineer-man/piston.git
synced 2025-06-08 03:06:26 +02:00
remove temp file after running
This commit is contained in:
parent
b85605a340
commit
037dedd162
1 changed files with 4 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
||||||
const { writeFileSync } = require('fs');
|
const { writeFileSync, unlinkSync } = require('fs');
|
||||||
const { spawn } = require('child_process');
|
const { spawn } = require('child_process');
|
||||||
|
|
||||||
function execute(language, source, stdin = '', args = []) {
|
function execute(language, source, stdin = '', args = []) {
|
||||||
|
@ -30,6 +30,8 @@ function execute(language, source, stdin = '', args = []) {
|
||||||
});
|
});
|
||||||
|
|
||||||
process.on('exit', code => {
|
process.on('exit', code => {
|
||||||
|
unlinkSync(sourceFile);
|
||||||
|
|
||||||
stderr = stderr.trim().substring(0, 65535);
|
stderr = stderr.trim().substring(0, 65535);
|
||||||
stdout = stdout.trim().substring(0, 65535);
|
stdout = stdout.trim().substring(0, 65535);
|
||||||
output = output.trim().substring(0, 65535);
|
output = output.trim().substring(0, 65535);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue