test/integration: write legacy DA trace line-by-line
console.log is unhappy about dumping a large file.
Change-Id: I8cbb756cbf63a7c18e13d19c591e8af487ed4adf
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/348531
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
diff --git a/test/integration/goDebug.test.ts b/test/integration/goDebug.test.ts
index a130b01..6c7ffb5 100644
--- a/test/integration/goDebug.test.ts
+++ b/test/integration/goDebug.test.ts
@@ -6,6 +6,7 @@
import * as assert from 'assert';
import * as cp from 'child_process';
import * as fs from 'fs';
+import * as readline from 'readline';
import * as http from 'http';
import { tmpdir } from 'os';
import * as net from 'net';
@@ -338,7 +339,7 @@
await dc.start();
});
- teardown(() => {
+ teardown(async () => {
if (dlvDapAdapter) {
const d = dlvDapAdapter;
dlvDapAdapter = null;
@@ -351,8 +352,14 @@
if (ctx.currentTest?.state === 'failed' && dapTraced) {
console.log(`${ctx.currentTest?.title} FAILED: Debug Adapter Trace`);
try {
- const buf = fs.readFileSync(path.join(tmpdir(), 'vscode-go-debug.txt'));
- console.log(buf.toString());
+ await new Promise<void>((resolve) => {
+ const rl = readline.createInterface({
+ input: fs.createReadStream(path.join(tmpdir(), 'vscode-go-debug.txt')),
+ crlfDelay: Infinity
+ });
+ rl.on('line', (line) => console.log(line));
+ rl.on('close', () => resolve());
+ });
} catch (e) {
console.log(`Failed to read trace: ${e}`);
}