Prefer gtar if available
This commit is contained in:
parent
4267fa66a2
commit
61c77a48ff
1 changed files with 16 additions and 1 deletions
17
src/tar.ts
17
src/tar.ts
|
|
@ -53,6 +53,21 @@ async function getTarVersion(programName: string): Promise<TarVersion> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function pickTarCommand(): Promise<TarVersion> {
|
||||||
|
// bsdtar 3.5.3 on the macos-14 (arm) action runner image is prone to crash with the following
|
||||||
|
// error messages when extracting zstd archives:
|
||||||
|
//
|
||||||
|
// tar: Child process exited with status 1
|
||||||
|
// tar: Error exit delayed from previous errors.
|
||||||
|
//
|
||||||
|
// To avoid this problem, prefer GNU tar under the name "gtar" if it is available.
|
||||||
|
try {
|
||||||
|
return await getTarVersion("gtar");
|
||||||
|
} catch {
|
||||||
|
return await getTarVersion("tar");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export interface ZstdAvailability {
|
export interface ZstdAvailability {
|
||||||
available: boolean;
|
available: boolean;
|
||||||
foundZstdBinary: boolean;
|
foundZstdBinary: boolean;
|
||||||
|
|
@ -64,7 +79,7 @@ export async function isZstdAvailable(
|
||||||
): Promise<ZstdAvailability> {
|
): Promise<ZstdAvailability> {
|
||||||
const foundZstdBinary = await isBinaryAccessible("zstd", logger);
|
const foundZstdBinary = await isBinaryAccessible("zstd", logger);
|
||||||
try {
|
try {
|
||||||
const tarVersion = await getTarVersion("tar");
|
const tarVersion = await pickTarCommand();
|
||||||
const { type, version } = tarVersion;
|
const { type, version } = tarVersion;
|
||||||
logger.info(`Found ${type} tar version ${version}.`);
|
logger.info(`Found ${type} tar version ${version}.`);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue