@@ -161,7 +161,7 @@ export interface IExecutionResult {
161161 stderr : string ;
162162}
163163
164- export async function exec ( child : cp . ChildProcess , defaultEncoding = 'utf8' ) : Promise < IExecutionResult > {
164+ export async function exec ( child : cp . ChildProcess ) : Promise < IExecutionResult > {
165165 const disposables : IDisposable [ ] = [ ] ;
166166
167167 const once = ( ee : NodeJS . EventEmitter , name : string , fn : Function ) => {
@@ -182,12 +182,12 @@ export async function exec(child: cp.ChildProcess, defaultEncoding = 'utf8'): Pr
182182 new Promise < string > ( c => {
183183 const buffers : string [ ] = [ ] ;
184184 on ( child . stdout , 'data' , b => buffers . push ( b ) ) ;
185- once ( child . stdout , 'close' , ( ) => c ( buffers . join ( ) ) ) ;
185+ once ( child . stdout , 'close' , ( ) => c ( buffers . join ( '' ) ) ) ;
186186 } ) ,
187187 new Promise < string > ( c => {
188188 const buffers : string [ ] = [ ] ;
189189 on ( child . stderr , 'data' , b => buffers . push ( b ) ) ;
190- once ( child . stderr , 'close' , ( ) => c ( buffers . join ( ) ) ) ;
190+ once ( child . stderr , 'close' , ( ) => c ( buffers . join ( '' ) ) ) ;
191191 } )
192192 ] ) ;
193193
@@ -252,7 +252,6 @@ export class GitError {
252252export interface IGitOptions {
253253 gitPath : string ;
254254 version : string ;
255- defaultEncoding ?: string ;
256255}
257256
258257export const GitErrorCodes = {
@@ -279,19 +278,17 @@ export class Git {
279278
280279 private gitPath : string ;
281280 private version : string ;
282- private defaultEncoding : string ;
283281
284282 private _onOutput = new EventEmitter < string > ( ) ;
285283 get onOutput ( ) : Event < string > { return this . _onOutput . event ; }
286284
287285 constructor ( options : IGitOptions ) {
288286 this . gitPath = options . gitPath ;
289287 this . version = options . version ;
290- this . defaultEncoding = options . defaultEncoding || 'utf8' ;
291288 }
292289
293290 open ( repository : string , env : any = { } ) : Repository {
294- return new Repository ( this , repository , this . defaultEncoding , env ) ;
291+ return new Repository ( this , repository , env ) ;
295292 }
296293
297294 async exec ( cwd : string , args : string [ ] , options : any = { } ) : Promise < IExecutionResult > {
@@ -384,7 +381,6 @@ export class Repository {
384381 constructor (
385382 private _git : Git ,
386383 private repository : string ,
387- private defaultEncoding : string ,
388384 private env : any = { }
389385 ) { }
390386
@@ -467,7 +463,7 @@ export class Repository {
467463
468464 private async doBuffer ( object : string ) : Promise < string > {
469465 const child = this . stream ( [ 'show' , object ] ) ;
470- const { exitCode, stdout } = await exec ( child , this . defaultEncoding ) ;
466+ const { exitCode, stdout } = await exec ( child ) ;
471467
472468 if ( exitCode ) {
473469 return Promise . reject < string > ( new GitError ( {
0 commit comments