Skip to content

Commit 49f2f13

Browse files
committedJul 23, 2016
Fix debugger when logging is off
Make sure to call connectClient even if no logging.
1 parent 5e6498f commit 49f2f13

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed
 

‎src/debugAdapter/goDebug.ts

+14-17
Original file line numberDiff line numberDiff line change
@@ -213,32 +213,29 @@ class Delve {
213213
});
214214

215215
function connectClient(port: number, host: string) {
216-
let client = Client.$create(port, host);
217-
client.connectSocket((err, conn) => {
218-
if (err) return reject(err);
219-
// Add a slight delay to avoid issues on Linux with
220-
// Delve failing calls made shortly after connection.
221-
setTimeout(() =>
222-
resolve(conn),
223-
200);
224-
});
216+
// Add a slight delay to avoid issues on Linux with
217+
// Delve failing calls made shortly after connection.
218+
setTimeout(() => {
219+
let client = Client.$create(port, host);
220+
client.connectSocket((err, conn) => {
221+
if (err) return reject(err);
222+
serverRunning = true;
223+
return resolve(conn);
224+
});
225+
}, 200);
226+
}
227+
228+
if (!serverRunning) {
229+
connectClient(port, host);
225230
}
226231

227232
this.debugProcess.stderr.on('data', chunk => {
228233
let str = chunk.toString();
229234
if (this.onstderr) { this.onstderr(str); }
230-
if (!serverRunning) {
231-
serverRunning = true;
232-
connectClient(port, host);
233-
}
234235
});
235236
this.debugProcess.stdout.on('data', chunk => {
236237
let str = chunk.toString();
237238
if (this.onstdout) { this.onstdout(str); }
238-
if (!serverRunning) {
239-
serverRunning = true;
240-
connectClient(port, host);
241-
}
242239
});
243240
this.debugProcess.on('close', function(code) {
244241
// TODO: Report `dlv` crash to user.

0 commit comments

Comments
 (0)
Please sign in to comment.