Browse Source

Fixes #2823 Handle stdout/stderr Buffers in shell run()

main
Victor Hallberg 1 year ago
committed by GitHub
parent
commit
87efc38dc1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions
  1. +4
    -0
      CHANGELOG.md
  2. +1
    -0
      README.md
  3. +5
    -4
      src/env/node/git/shell.ts

+ 4
- 0
CHANGELOG.md View File

@ -12,6 +12,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Changes _Default Graph Column Layout_ context menu command to _Use Expanded Graph Column_ for better clarity
- Improves remote parsing for better integration support for some edge cases
### Fixed
- Fixes [#2823](https://github.com/gitkraken/vscode-gitlens/issues/2823) - Handle stdout/stderr Buffers in shell run()
## [14.1.1] - 2023-07-18
### Added

+ 1
- 0
README.md View File

@ -351,6 +351,7 @@ A big thanks to the people that have contributed to this project 🙏❤️:
- Vladislav Guleaev ([@vguleaev](https://github.com/vguleaev)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=vguleaev)
- Dmitry Gurovich ([@yrtimiD](https://github.com/yrtimiD)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=yrtimiD)
- hahaaha ([@hahaaha](https://github.com/hahaaha)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=hahaaha)
- Victor Hallberg ([@mogelbrod](https://github.com/mogelbrod)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=mogelbrod)
- Ken Hom ([@kh0m](https://github.com/kh0m)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=kh0m)
- Yukai Huang ([@Yukaii](https://github.com/Yukaii)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=Yukaii)
- Justin Hutchings ([@jhutchings1](https://github.com/jhutchings1)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=jhutchings1)

+ 5
- 4
src/env/node/git/shell.ts View File

@ -245,11 +245,12 @@ export function run(
error.message = `Command output exceeded the allocated stdout buffer. Set 'options.maxBuffer' to a larger value than ${opts.maxBuffer} bytes`;
}
let stdoutDecoded;
let stderrDecoded;
let stdoutDecoded: string;
let stderrDecoded: string;
if (encoding === 'utf8' || encoding === 'binary' || encoding === 'buffer') {
stdoutDecoded = stdout;
stderrDecoded = stderr;
// stdout & stderr can be `Buffer` or `string
stdoutDecoded = stdout.toString();
stderrDecoded = stderr.toString();
} else {
const decode = (await import(/* webpackChunkName: "encoding" */ 'iconv-lite')).decode;
stdoutDecoded = decode(Buffer.from(stdout, 'binary'), encoding);

Loading…
Cancel
Save