Skip to content

Commit 87efc38

Browse files
authored
Fixes #2823 Handle stdout/stderr Buffers in shell run()
1 parent ee7a971 commit 87efc38

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1212
- Changes _Default Graph Column Layout_ context menu command to _Use Expanded Graph Column_ for better clarity
1313
- Improves remote parsing for better integration support for some edge cases
1414

15+
### Fixed
16+
17+
- Fixes [#2823](https://github.com/gitkraken/vscode-gitlens/issues/2823) - Handle stdout/stderr Buffers in shell run()
18+
1519
## [14.1.1] - 2023-07-18
1620

1721
### Added

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ A big thanks to the people that have contributed to this project 🙏❤️:
351351
- Vladislav Guleaev ([@vguleaev](https://github.com/vguleaev)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=vguleaev)
352352
- Dmitry Gurovich ([@yrtimiD](https://github.com/yrtimiD)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=yrtimiD)
353353
- hahaaha ([@hahaaha](https://github.com/hahaaha)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=hahaaha)
354+
- Victor Hallberg ([@mogelbrod](https://github.com/mogelbrod)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=mogelbrod)
354355
- Ken Hom ([@kh0m](https://github.com/kh0m)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=kh0m)
355356
- Yukai Huang ([@Yukaii](https://github.com/Yukaii)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=Yukaii)
356357
- Justin Hutchings ([@jhutchings1](https://github.com/jhutchings1)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=jhutchings1)

src/env/node/git/shell.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,12 @@ export function run<T extends number | string | Buffer>(
245245
error.message = `Command output exceeded the allocated stdout buffer. Set 'options.maxBuffer' to a larger value than ${opts.maxBuffer} bytes`;
246246
}
247247

248-
let stdoutDecoded;
249-
let stderrDecoded;
248+
let stdoutDecoded: string;
249+
let stderrDecoded: string;
250250
if (encoding === 'utf8' || encoding === 'binary' || encoding === 'buffer') {
251-
stdoutDecoded = stdout;
252-
stderrDecoded = stderr;
251+
// stdout & stderr can be `Buffer` or `string
252+
stdoutDecoded = stdout.toString();
253+
stderrDecoded = stderr.toString();
253254
} else {
254255
const decode = (await import(/* webpackChunkName: "encoding" */ 'iconv-lite')).decode;
255256
stdoutDecoded = decode(Buffer.from(stdout, 'binary'), encoding);

0 commit comments

Comments
 (0)