Allow warnings in tryGetFolderBytes to be suppressed
To avoid confusing run annotations when dependency caching is enabled
This commit is contained in:
parent
b0c0aadc56
commit
7bc6222c12
9 changed files with 25 additions and 11 deletions
8
lib/util.js
generated
8
lib/util.js
generated
|
|
@ -610,14 +610,18 @@ function listFolder(dir) {
|
|||
*
|
||||
* @param cacheDir A directory to get the size of.
|
||||
* @param logger A logger to log any errors to.
|
||||
* @param quiet A value indicating whether to suppress warnings for errors (default: false).
|
||||
* Ignored if the log level is `debug`.
|
||||
* @returns The size in bytes of the folder, or undefined if errors occurred.
|
||||
*/
|
||||
async function tryGetFolderBytes(cacheDir, logger) {
|
||||
async function tryGetFolderBytes(cacheDir, logger, quiet = false) {
|
||||
try {
|
||||
return await (0, util_1.promisify)(get_folder_size_1.default)(cacheDir);
|
||||
}
|
||||
catch (e) {
|
||||
logger.warning(`Encountered an error while getting size of folder: ${e}`);
|
||||
if (!quiet || logger.isDebug()) {
|
||||
logger.warning(`Encountered an error while getting size of '${cacheDir}': ${e}`);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue