diff --git a/backend/api.js b/backend/api.js index 5790306..5a372ba 100644 --- a/backend/api.js +++ b/backend/api.js @@ -12,7 +12,7 @@ import * as util from "./util.js"; import { bash, getUUID, logError } from "./util.js"; const allSessions = new Set(); -export const TEST_RUN_FINISHED = 'Test run finished!\n' +export const TEST_RUN_FINISHED = "Test run finished!\n"; export class Session { get homedir() { return "/home/riju/src"; @@ -235,9 +235,7 @@ export class Session { break; } await this.runCode(msg.code, msg.expectedOutput); - setTimeout(() => { - this.term.pty.stdin.write(TEST_RUN_FINISHED); - }, 1500) + this.term.pty.stdin.write(TEST_RUN_FINISHED); break; case "formatCode": if (typeof msg.code !== "string") { @@ -336,7 +334,7 @@ export class Session { this.send({ event: "terminalOutput", output: data.toString(), - expectedOutput + expectedOutput, }); } }); diff --git a/frontend/src/app.js b/frontend/src/app.js index 95d0ae0..a0127bd 100644 --- a/frontend/src/app.js +++ b/frontend/src/app.js @@ -2,7 +2,6 @@ import { Terminal } from "xterm"; import { FitAddon } from "xterm-addon-fit"; import "xterm/css/xterm.css"; -import { TEST_RUN_FINISHED } from "../../backend/api"; const DEBUG = window.location.hash === "#debug"; const config = window.rijuConfig; @@ -153,7 +152,7 @@ async function main() { term.write(message.output); testData.push(message.output); - if (testData.join("").includes(TEST_RUN_FINISHED)) { + if (testData.join("").includes('Test run finished')) { postTestResults(testData, message.expectedOutput); testData = []; }