-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile-run.txt
34 lines (31 loc) · 947 Bytes
/
compile-run.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
app.post("/",function(req,res){
res.send(`<h3>Register</h3>`);
var submission=req.body.submission;
var input=req.body.input;
fs.writeFile(__dirname+"/codes/a.c",submission,function(){
var resultPromise = c.runFile(__dirname+"/codes/a.c", { stdin:input});
resultPromise
.then(result => {
res.set('Content-Type', 'text/plain');
if (result['stderr'] != "" || result['errorType'] != null){
console.log(result['stderr']);
console.log(result['memoryUsage']);
console.log(result['cpuUsage']);
//res.write(result['stdout']);
res.write(result['errorType'] + " error" + "\n");
res.write(result['stderr']);
res.end();
}
else{
console.log(result['memoryUsage']);
console.log(result['cpuUsage']);
res.send(result['stdout']);
//res.send(result);
}
})
.catch(err => {
console.log(err);
});
});
});*/