diff --git a/CHANGELOG.md b/CHANGELOG.md index d3c3ce9..418a269 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to the "keil-assistant" extension will be documented in this file. +## [v1.8.7] +- Fixed: +- Build log are garbled +*** + ## [v1.8.6] - Fixed: - Keil log out show diff --git a/package.json b/package.json index b57e66b..79ce27a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "keil-vscode-assistant", "displayName": "%displayName%", "description": "%description%", - "version": "1.8.6", + "version": "1.8.7", "publisher": "jacksonjim", "icon": "res/icons/icon.png", "author": "jacksonjim ", diff --git a/src/extension.ts b/src/extension.ts index ae01e0e..cbf34a5 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -778,12 +778,16 @@ abstract class Target implements IView { const fd = openSync(this.uv4LogFile.path, 'r'); const watcher = workspace.createFileSystemWatcher(this.uv4LogFile.path, false, false, false); let curPos = 0; + const buf = Buffer.alloc(1024); watcher.onDidChange(() => { const stats = statSync(this.uv4LogFile.path); if (stats && stats.size > 0) { - const buf = Buffer.alloc(1024); - curPos += readSync(fd, buf, 0, 1024, curPos); - this.taskChannel?.appendLine(this.dealBuildLog(buf)); + const numRead = readSync(fd, buf, 0, 1024, curPos); + if (numRead > 0) { + curPos += numRead; + const txt = this.dealBuildLog(buf.slice(0, numRead)); + this.taskChannel?.appendLine(txt); + } } });