Output stdout upon error in getFileType

This commit is contained in:
Michael B. Gale 2023-10-04 09:46:17 +01:00
parent df098abd11
commit 4cee553ea6
No known key found for this signature in database
GPG key ID: FF5E2765BD00628F
3 changed files with 9 additions and 9 deletions

8
lib/actions-util.js generated
View file

@ -385,23 +385,23 @@ exports.getWorkflowRunAttempt = getWorkflowRunAttempt;
*/
const getFileType = async (fp) => {
let stderr = "";
let stdout = "";
try {
let fileOut = "";
await new toolrunner.ToolRunner(await safeWhich.safeWhich("file"), ["-L", fp], {
silent: true,
listeners: {
stdout: (data) => {
fileOut += data.toString();
stdout += data.toString();
},
stderr: (data) => {
stderr += data.toString();
},
},
}).exec();
return fileOut;
return stdout;
}
catch (e) {
core.info(`Could not determine type of ${fp}. ${stderr}`);
core.info(`Could not determine type of ${fp} from ${stdout}. ${stderr}`);
throw e;
}
};

File diff suppressed because one or more lines are too long

View file

@ -431,8 +431,8 @@ export function getWorkflowRunAttempt(): number {
*/
export const getFileType = async (fp: string): Promise<string> => {
let stderr = "";
let stdout = "";
try {
let fileOut = "";
await new toolrunner.ToolRunner(
await safeWhich.safeWhich("file"),
["-L", fp],
@ -440,7 +440,7 @@ export const getFileType = async (fp: string): Promise<string> => {
silent: true,
listeners: {
stdout: (data) => {
fileOut += data.toString();
stdout += data.toString();
},
stderr: (data) => {
stderr += data.toString();
@ -448,9 +448,9 @@ export const getFileType = async (fp: string): Promise<string> => {
},
},
).exec();
return fileOut;
return stdout;
} catch (e) {
core.info(`Could not determine type of ${fp}. ${stderr}`);
core.info(`Could not determine type of ${fp} from ${stdout}. ${stderr}`);
throw e;
}