mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 07:16:34 +00:00
fix(judge): modify timeout handling logic to resolve on time limit exceeded
This commit is contained in:
parent
03f3d9682a
commit
11c2e2c317
@ -190,7 +190,7 @@ async function run(container: Docker.Container, fileName: string, timeLimit?: nu
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Start the exec stream
|
// Start the exec stream
|
||||||
runExec.start({}, async (error, stream) => {
|
runExec.start({}, (error, stream) => {
|
||||||
if (error || !stream) {
|
if (error || !stream) {
|
||||||
return reject({ output: "System Error", exitCode: ExitCode.SE });
|
return reject({ output: "System Error", exitCode: ExitCode.SE });
|
||||||
}
|
}
|
||||||
@ -198,9 +198,7 @@ async function run(container: Docker.Container, fileName: string, timeLimit?: nu
|
|||||||
docker.modem.demuxStream(stream, stdoutStream, stderrStream);
|
docker.modem.demuxStream(stream, stdoutStream, stderrStream);
|
||||||
|
|
||||||
// Timeout mechanism
|
// Timeout mechanism
|
||||||
const timeoutId = setTimeout(() => {
|
const timeoutId = setTimeout(async () => {
|
||||||
// Timeout reached, kill the container
|
|
||||||
container.kill();
|
|
||||||
resolve({
|
resolve({
|
||||||
output: "Time Limit Exceeded",
|
output: "Time Limit Exceeded",
|
||||||
exitCode: ExitCode.TLE,
|
exitCode: ExitCode.TLE,
|
||||||
|
Loading…
Reference in New Issue
Block a user