remove temp file after running

This commit is contained in:
Brian Seymour 2021-01-21 19:07:23 -06:00
parent b85605a340
commit 037dedd162
1 changed files with 4 additions and 2 deletions

View File

@ -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);