Skip to content

Commit ca02612

Browse files
committed
flush stdout force
1 parent 0c546a7 commit ca02612

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎v4-cokapi/backends/javascript/jslogger.js‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,8 +980,13 @@ function listener(event, execState, eventData, data) {
980980
exception_msg: 'Stopped after running ' + MAX_EXECUTED_LINES + ' steps. Please shorten your code,\nsince Python Tutor is not designed to handle long-running code.'});
981981

982982
finalize();
983+
983984
// GET OUTTA HERE so that the user's script doesn't keep infinite looping
984-
process.exit(); // NB: on Node v6 this will CUT OFF the stdout output to terminal (but OK if redirected to file), ergh :(
985+
986+
// SUPER HACKY SHADY WAY TO FLUSH stdout before forcing an exit, OMG!!!
987+
// https://groups.google.com/forum/#!topic/nodejs-dev/Tj_HNQbvtZs
988+
while (!process.stdout.flush());
989+
process.exit();
985990
} else {
986991
assert(stepType !== undefined);
987992
execState.prepareStep(stepType); // set debugger to stop at next step

0 commit comments

Comments
 (0)