Skip to content

Commit 484ae74

Browse files
committed
flushed stdout properly, i hope
1 parent ca02612 commit 484ae74

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -979,14 +979,13 @@ function listener(event, execState, eventData, data) {
979979
curTrace.push({event: 'instruction_limit_reached',
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

982-
finalize();
983-
984982
// GET OUTTA HERE so that the user's script doesn't keep infinite looping
985983

986984
// SUPER HACKY SHADY WAY TO FLUSH stdout before forcing an exit, OMG!!!
987985
// https://groups.google.com/forum/#!topic/nodejs-dev/Tj_HNQbvtZs
988-
while (!process.stdout.flush());
989-
process.exit();
986+
while (!process.stdout.flush()); // flush before finalize; for some weird reason it works, ergh
987+
finalize();
988+
process.exit(0 /* don't use an error exit code so that we don't trigger error handlers later on */);
990989
} else {
991990
assert(stepType !== undefined);
992991
execState.prepareStep(stepType); // set debugger to stop at next step
@@ -1163,6 +1162,7 @@ function finalize() {
11631162
log('Wrote trace to', argv.jsfile);
11641163
} else if (argv.jsondump) {
11651164
console.log(JSON.stringify(blob));
1165+
//console.log(JSON.stringify(blob, null, ' '));
11661166
} else if (argv.prettydump) {
11671167
console.log(util.inspect(blob, {depth: null}));
11681168
}

‎v4-cokapi/cokapi.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ var NODE_BIN = '/usr/local/bin/node';
5757
var PYTHON2_BIN = '/usr/bin/python';
5858
var PYTHON3_BIN = '/usr/local/bin/python3.3';
5959

60-
var TIMEOUT_SECS = 5;
60+
var TIMEOUT_SECS = 10;
6161
var JAVA_TIMEOUT_SECS = 15; // the Java backend is SUPER SLOW :/
6262
var CPP_TIMEOUT_SECS = 15; // the C/C++ backend is also SUPER SLOW :/
6363

0 commit comments

Comments
 (0)