Produce a clearer error message when file is not installed
This commit is contained in:
parent
24a01703e4
commit
8ea1a11e72
3 changed files with 31 additions and 15 deletions
10
lib/actions-util.js
generated
10
lib/actions-util.js
generated
|
|
@ -387,11 +387,19 @@ exports.getWorkflowRunAttempt = getWorkflowRunAttempt;
|
|||
const getFileType = async (filePath) => {
|
||||
let stderr = "";
|
||||
let stdout = "";
|
||||
let fileCmdPath;
|
||||
try {
|
||||
fileCmdPath = await safeWhich.safeWhich("file");
|
||||
}
|
||||
catch (e) {
|
||||
core.info("The `file` program is required, but does not appear to be installed. Please install it.");
|
||||
throw e;
|
||||
}
|
||||
try {
|
||||
// The `file` command will output information about the type of file pointed at by `filePath`.
|
||||
// For binary files, this may include e.g. whether they are static of dynamic binaries.
|
||||
// The `-L` switch instructs the command to follow symbolic links.
|
||||
await new toolrunner.ToolRunner(await safeWhich.safeWhich("file"), ["-L", filePath], {
|
||||
await new toolrunner.ToolRunner(fileCmdPath, ["-L", filePath], {
|
||||
silent: true,
|
||||
listeners: {
|
||||
stdout: (data) => {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue