use safeWhich
This commit is contained in:
parent
8c91ba83e2
commit
ce467e7e36
3 changed files with 16 additions and 10 deletions
3
lib/toolcache.js
generated
3
lib/toolcache.js
generated
|
|
@ -13,6 +13,7 @@ const path = __importStar(require("path"));
|
||||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||||
const io = __importStar(require("@actions/io"));
|
const io = __importStar(require("@actions/io"));
|
||||||
const actionsToolcache = __importStar(require("@actions/tool-cache"));
|
const actionsToolcache = __importStar(require("@actions/tool-cache"));
|
||||||
|
const safeWhich = __importStar(require("@chrisgavin/safe-which"));
|
||||||
const semver = __importStar(require("semver"));
|
const semver = __importStar(require("semver"));
|
||||||
/*
|
/*
|
||||||
* This file acts as an interface to the functionality of the actions toolcache.
|
* This file acts as an interface to the functionality of the actions toolcache.
|
||||||
|
|
@ -47,7 +48,7 @@ async function extractTar(file, mode, tempDir, logger) {
|
||||||
// Determine whether GNU tar
|
// Determine whether GNU tar
|
||||||
logger.debug("Checking tar --version");
|
logger.debug("Checking tar --version");
|
||||||
let versionOutput = "";
|
let versionOutput = "";
|
||||||
await new toolrunner.ToolRunner("tar", ["--version"], {
|
await new toolrunner.ToolRunner(await safeWhich.safeWhich("tar"), ["--version"], {
|
||||||
ignoreReturnCode: true,
|
ignoreReturnCode: true,
|
||||||
silent: true,
|
silent: true,
|
||||||
listeners: {
|
listeners: {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -5,6 +5,7 @@ import * as path from "path";
|
||||||
import * as toolrunner from "@actions/exec/lib/toolrunner";
|
import * as toolrunner from "@actions/exec/lib/toolrunner";
|
||||||
import * as io from "@actions/io";
|
import * as io from "@actions/io";
|
||||||
import * as actionsToolcache from "@actions/tool-cache";
|
import * as actionsToolcache from "@actions/tool-cache";
|
||||||
|
import * as safeWhich from "@chrisgavin/safe-which";
|
||||||
import * as semver from "semver";
|
import * as semver from "semver";
|
||||||
|
|
||||||
import { Logger } from "./logging";
|
import { Logger } from "./logging";
|
||||||
|
|
@ -49,14 +50,18 @@ export async function extractTar(
|
||||||
// Determine whether GNU tar
|
// Determine whether GNU tar
|
||||||
logger.debug("Checking tar --version");
|
logger.debug("Checking tar --version");
|
||||||
let versionOutput = "";
|
let versionOutput = "";
|
||||||
await new toolrunner.ToolRunner("tar", ["--version"], {
|
await new toolrunner.ToolRunner(
|
||||||
ignoreReturnCode: true,
|
await safeWhich.safeWhich("tar"),
|
||||||
silent: true,
|
["--version"],
|
||||||
listeners: {
|
{
|
||||||
stdout: (data) => (versionOutput += data.toString()),
|
ignoreReturnCode: true,
|
||||||
stderr: (data) => (versionOutput += data.toString()),
|
silent: true,
|
||||||
},
|
listeners: {
|
||||||
}).exec();
|
stdout: (data) => (versionOutput += data.toString()),
|
||||||
|
stderr: (data) => (versionOutput += data.toString()),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
).exec();
|
||||||
logger.debug(versionOutput.trim());
|
logger.debug(versionOutput.trim());
|
||||||
const isGnuTar = versionOutput.toUpperCase().includes("GNU TAR");
|
const isGnuTar = versionOutput.toUpperCase().includes("GNU TAR");
|
||||||
// Initialize args
|
// Initialize args
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue