Skip to content

Commit a12ae43

Browse files
stmcginnisSergey Vilgelm
and
Sergey Vilgelm
authored
Add --overwrite flag to tar extraction (#156)
* Add --overwrite flag to tar extraction There are times when previous actions have already extracted at least some files to the cache location. This results in subsequent cache extraction operations to emit errors such as: > /usr/bin/tar: [dest_file_path]: Cannot open: File exists This adds the --overwrite flag to the extract call to force tar to just overwrite these files rather than reporting errors. Signed-off-by: Sean McGinnis <[email protected]> * npm run lint-fix & npm run format * ignore macOS Co-authored-by: Sergey Vilgelm <[email protected]>
1 parent f1dee55 commit a12ae43

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

dist/post_run/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49250,7 +49250,12 @@ function installLint(versionConfig) {
4925049250
repl = /\.zip$/;
4925149251
}
4925249252
else {
49253-
extractedDir = yield tc.extractTar(archivePath, process.env.HOME);
49253+
// We want to always overwrite files if the local cache already has them
49254+
const args = ["xz"];
49255+
if (process.platform.toString() != "darwin") {
49256+
args.push("--overwrite");
49257+
}
49258+
extractedDir = yield tc.extractTar(archivePath, process.env.HOME, args);
4925449259
}
4925549260
const urlParts = assetURL.split(`/`);
4925649261
const dirName = urlParts[urlParts.length - 1].replace(repl, ``);

dist/run/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49260,7 +49260,12 @@ function installLint(versionConfig) {
4926049260
repl = /\.zip$/;
4926149261
}
4926249262
else {
49263-
extractedDir = yield tc.extractTar(archivePath, process.env.HOME);
49263+
// We want to always overwrite files if the local cache already has them
49264+
const args = ["xz"];
49265+
if (process.platform.toString() != "darwin") {
49266+
args.push("--overwrite");
49267+
}
49268+
extractedDir = yield tc.extractTar(archivePath, process.env.HOME, args);
4926449269
}
4926549270
const urlParts = assetURL.split(`/`);
4926649271
const dirName = urlParts[urlParts.length - 1].replace(repl, ``);

src/install.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ export async function installLint(versionConfig: VersionConfig): Promise<string>
4545
extractedDir = await tc.extractZip(archivePath, process.env.HOME)
4646
repl = /\.zip$/
4747
} else {
48-
extractedDir = await tc.extractTar(archivePath, process.env.HOME)
48+
// We want to always overwrite files if the local cache already has them
49+
const args = ["xz"]
50+
if (process.platform.toString() != "darwin") {
51+
args.push("--overwrite")
52+
}
53+
extractedDir = await tc.extractTar(archivePath, process.env.HOME, args)
4954
}
5055

5156
const urlParts = assetURL.split(`/`)

0 commit comments

Comments
 (0)