Spaces:
Sleeping
Sleeping
Update index.js
Browse files
index.js
CHANGED
@@ -79,10 +79,11 @@ app.post("/compile", function (req, res) {
|
|
79 |
}
|
80 |
const cppProcess = exec(
|
81 |
"g++ -o /code/temp/Main /code/temp/Main.cpp && /code/temp/Main",
|
|
|
82 |
(error, stdout, stderr) => {
|
83 |
if (error) {
|
84 |
console.error(error);
|
85 |
-
res.send({ error:
|
86 |
return;
|
87 |
}
|
88 |
console.error(stderr);
|
|
|
79 |
}
|
80 |
const cppProcess = exec(
|
81 |
"g++ -o /code/temp/Main /code/temp/Main.cpp && /code/temp/Main",
|
82 |
+
{ timeout: TIMEOUT_VALUE }, // Add timeout option
|
83 |
(error, stdout, stderr) => {
|
84 |
if (error) {
|
85 |
console.error(error);
|
86 |
+
res.send({ error: "Compilation or execution timed out" });
|
87 |
return;
|
88 |
}
|
89 |
console.error(stderr);
|