@@ -20,8 +20,8 @@ export type TarVersion = {
2020 version : string ;
2121} ;
2222
23- async function getTarVersion ( ) : Promise < TarVersion > {
24- const tar = await io . which ( "tar" , true ) ;
23+ async function getTarVersion ( programName : string ) : Promise < TarVersion > {
24+ const tar = await io . which ( programName , true ) ;
2525 let stdout = "" ;
2626 const exitCode = await new ToolRunner ( tar , [ "--version" ] , {
2727 listeners : {
@@ -31,23 +31,23 @@ async function getTarVersion(): Promise<TarVersion> {
3131 } ,
3232 } ) . exec ( ) ;
3333 if ( exitCode !== 0 ) {
34- throw new Error ( " Failed to call tar --version" ) ;
34+ throw new Error ( ` Failed to call ${ programName } --version` ) ;
3535 }
3636 // Return whether this is GNU tar or BSD tar, and the version number
3737 if ( stdout . includes ( "GNU tar" ) ) {
3838 const match = stdout . match ( / t a r \( G N U t a r \) ( [ 0 - 9 . ] + ) / ) ;
3939 if ( ! match || ! match [ 1 ] ) {
40- throw new Error ( " Failed to parse output of tar --version." ) ;
40+ throw new Error ( ` Failed to parse output of ${ programName } --version.` ) ;
4141 }
4242
43- return { name : "tar" , type : "gnu" , version : match [ 1 ] } ;
43+ return { name : programName , type : "gnu" , version : match [ 1 ] } ;
4444 } else if ( stdout . includes ( "bsdtar" ) ) {
4545 const match = stdout . match ( / b s d t a r ( [ 0 - 9 . ] + ) / ) ;
4646 if ( ! match || ! match [ 1 ] ) {
47- throw new Error ( " Failed to parse output of tar --version." ) ;
47+ throw new Error ( ` Failed to parse output of ${ programName } --version.` ) ;
4848 }
4949
50- return { name : "tar" , type : "bsd" , version : match [ 1 ] } ;
50+ return { name : programName , type : "bsd" , version : match [ 1 ] } ;
5151 } else {
5252 throw new Error ( "Unknown tar version" ) ;
5353 }
@@ -64,7 +64,7 @@ export async function isZstdAvailable(
6464) : Promise < ZstdAvailability > {
6565 const foundZstdBinary = await isBinaryAccessible ( "zstd" , logger ) ;
6666 try {
67- const tarVersion = await getTarVersion ( ) ;
67+ const tarVersion = await getTarVersion ( "tar" ) ;
6868 const { type, version } = tarVersion ;
6969 logger . info ( `Found ${ type } tar version ${ version } .` ) ;
7070 switch ( type ) {
0 commit comments