diff --git a/packages/cmd/src/commands/utils.ts b/packages/cmd/src/commands/utils.ts index 06da5e3..2033b14 100644 --- a/packages/cmd/src/commands/utils.ts +++ b/packages/cmd/src/commands/utils.ts @@ -29,7 +29,6 @@ export async function commandHandler>( process.exit(0); } catch (e) { const failOnError = options?.failOnError ?? true; - let exitCode = e instanceof CommanderError ? e.exitCode : 1; if ( e instanceof CommanderError || @@ -40,12 +39,12 @@ export async function commandHandler>( error(e.message); } else { warnWithNoTrace(e.message); - exitCode = 0; } } else { error('Script execution failed: %o', e); } - process.exit(exitCode); + const exitCode = e instanceof CommanderError ? e.exitCode : 1; + process.exit(failOnError ? exitCode : 0); } } diff --git a/packages/cmd/src/services/cache/get.ts b/packages/cmd/src/services/cache/get.ts index a960212..b1b3b7e 100644 --- a/packages/cmd/src/services/cache/get.ts +++ b/packages/cmd/src/services/cache/get.ts @@ -4,6 +4,7 @@ import { retrieveCache } from '../../api'; import { PRESETS } from '../../commands/cache/options'; import { getCacheCommandConfig } from '../../config/cache'; import { getCI } from '../../env/ciProvider'; +import { success } from '../../logger'; import { unzipBuffer } from './fs'; import { MetaFile } from './lib'; import { download } from './network'; @@ -45,6 +46,8 @@ export async function handleGetCache() { if (preset === PRESETS.lastRun) { await handlePostLastRunPreset(config.values, ci, meta); } + + success('Cache restored. Cache ID: %s', result.cacheId); } catch (e) { if (isAxiosError(e)) { if ( diff --git a/packages/cmd/src/services/cache/set.ts b/packages/cmd/src/services/cache/set.ts index 7ed6262..d54b7e1 100644 --- a/packages/cmd/src/services/cache/set.ts +++ b/packages/cmd/src/services/cache/set.ts @@ -3,6 +3,7 @@ import { createCache } from '../../api'; import { PRESETS } from '../../commands/cache/options'; import { getCacheCommandConfig } from '../../config/cache'; import { getCI } from '../../env/ciProvider'; +import { success } from '../../logger'; import { filterPaths, zipFilesToBuffer } from './fs'; import { createMeta, getLastRunFilePath } from './lib'; import { @@ -66,6 +67,8 @@ export async function handleSetCache() { cacheId: result.cacheId, uploadUrl: result.metaUploadUrl, }); + + success('Cache uploaded. Cache ID: %s', result.cacheId); } async function handleArchiveUpload({