Skip to content

REPL output sometimes cuts off/drops early #164

@kwshi

Description

@kwshi

Sometimes, the REPL doesn't print output that it's supposed to print, and the program prematurely ends before all output has been sent. Example-- the following program prints 0 through 9; when this program is run, most of the times the correct output is shown but sometimes, seemingly at random, the output cuts off early:

image

Inspecting the websocket message log shows the following exchange:

  • (up) {"event":"runCode","code":"#include <iostream>\n\nint main() {\n for (int i = 0; i < 10; ++i) {\n std::cout << i << std::endl;\n }\n}\n"}
  • (down) {"event":"terminalClear"}
  • (down) {"event":"terminalOutput","output":"0\r\n1\r\n2\r\n3\r\n"}
  • (down) {"event":"serviceFailed","service":"terminal","error":"Exited with status 0","code":0}
  • (down) {"event":"terminalInput","input":"\r"}

So it seems like the missing output is not transmitted at all by the server, rather than it being hidden by some UI-level bug.

(Another example, in which the last output line hello is dropped:)
image

  • (up) {"event":"runCode","code":"#include <iostream>\n\nint main() {\n for (int i = 0; i < 5; ++i) {\n std::cout << i << std::endl;\n }\n\n int n;\n std::cin >> n;\n\n std::cout << \"hello \" << n << std::endl;\n}\n"}
  • (down) {"event":"terminalClear"}
  • (down) {"event":"terminalOutput","output":"0\r\n1\r\n2\r\n3\r\n4\r\n"}
  • (up) {"event":"terminalInput","input":"7"}
  • (down) {"event":"terminalOutput","output":"7"}
  • (down) (down) {"event":"serviceFailed","service":"terminal","error":"Exited with status 0","code":0}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions