Skip to content
This repository was archived by the owner on Feb 27, 2025. It is now read-only.

Commit 5879fa3

Browse files
committed
Temporarily fix #5.
1 parent 9fbf207 commit 5879fa3

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/debug/.vscode/launch.json

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
"stopOnEntry": false,
1111
"args": [ "--server=4711" ],
1212
"sourceMaps": true,
13+
"env": {
14+
"DEBUG_VSCODE_OCAML": "development"
15+
},
1316
"outDir": "${workspaceRoot}/../../out/src/debug"
1417
}
1518
]

src/debug/debug.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,22 @@ class OCamlDebugSession extends DebugSession {
6161
readUntilPrompt(callback?) {
6262
return new Promise((resolve) => {
6363
let buffer = '';
64-
let onData = (chunk) => {
65-
buffer += chunk.toString('utf-8').replace(/\r\n/g, '\n');
66-
if (callback) callback(buffer);
64+
let timer;
65+
let onTimeout = () => {
6766
if (buffer.slice(-6) === '(ocd) ') {
6867
let output = buffer.slice(0, -6);
6968
output = output.replace(/\n$/, '');
7069
log(`ocd: ${JSON.stringify(output)}`);
7170
resolve(output);
7271
this._debuggerProc.stdout.removeListener('data', onData);
73-
return;
7472
}
7573
};
74+
let onData = (chunk) => {
75+
buffer += chunk.toString('utf-8').replace(/\r\n/g, '\n');
76+
if (callback) callback(buffer);
77+
clearTimeout(timer);
78+
setTimeout(onTimeout, 64);
79+
};
7680
this._debuggerProc.stdout.on('data', onData);
7781
});
7882
}
@@ -163,7 +167,6 @@ class OCamlDebugSession extends DebugSession {
163167
ocdArgs.push(path.normalize(args.program));
164168

165169
this._launchArgs = args;
166-
console.log(ocdArgs);
167170
this._debuggerProc = child_process.spawn('ocamldebug', ocdArgs);
168171
this._breakpoints = new Map();
169172

0 commit comments

Comments
 (0)