Skip to content

Commit ce467e7

Browse files
use safeWhich
1 parent 8c91ba8 commit ce467e7

3 files changed

Lines changed: 16 additions & 10 deletions

File tree

lib/toolcache.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/toolcache.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/toolcache.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as path from "path";
55
import * as toolrunner from "@actions/exec/lib/toolrunner";
66
import * as io from "@actions/io";
77
import * as actionsToolcache from "@actions/tool-cache";
8+
import * as safeWhich from "@chrisgavin/safe-which";
89
import * as semver from "semver";
910

1011
import { Logger } from "./logging";
@@ -49,14 +50,18 @@ export async function extractTar(
4950
// Determine whether GNU tar
5051
logger.debug("Checking tar --version");
5152
let versionOutput = "";
52-
await new toolrunner.ToolRunner("tar", ["--version"], {
53-
ignoreReturnCode: true,
54-
silent: true,
55-
listeners: {
56-
stdout: (data) => (versionOutput += data.toString()),
57-
stderr: (data) => (versionOutput += data.toString()),
58-
},
59-
}).exec();
53+
await new toolrunner.ToolRunner(
54+
await safeWhich.safeWhich("tar"),
55+
["--version"],
56+
{
57+
ignoreReturnCode: true,
58+
silent: true,
59+
listeners: {
60+
stdout: (data) => (versionOutput += data.toString()),
61+
stderr: (data) => (versionOutput += data.toString()),
62+
},
63+
}
64+
).exec();
6065
logger.debug(versionOutput.trim());
6166
const isGnuTar = versionOutput.toUpperCase().includes("GNU TAR");
6267
// Initialize args

0 commit comments

Comments
 (0)