From a219bc24fe0ebb3cc1c7b1c989a660c0dbdbac95 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Wed, 6 Aug 2025 09:43:02 +0200 Subject: [PATCH] feat: in headless mode exit on error if heap memory over limit --- .../assets/deploy/deploy.assert.services.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/services/assets/deploy/deploy.assert.services.ts b/src/services/assets/deploy/deploy.assert.services.ts index 28ad08e5..e5517157 100644 --- a/src/services/assets/deploy/deploy.assert.services.ts +++ b/src/services/assets/deploy/deploy.assert.services.ts @@ -5,6 +5,7 @@ import { MEMORY_HEAP_WARNING, MEMORY_SIZE_ENDPOINT_VERSION } from '../../../constants/deploy.constants'; +import {isHeadless} from '../../../utils/process.utils'; import {NEW_CMD_LINE, confirmAndExit} from '../../../utils/prompt.utils'; import {assertConfigAndLoadSatelliteContext} from '../../../utils/satellite.utils'; @@ -46,11 +47,14 @@ export const assertSatelliteMemorySize = async () => { maximumSignificantDigits: 3 }).format(Number(value) / 1_000_000); - await confirmAndExit( - `⚠️ Your satellite's heap memory is ${formatNumber( - heap - )} MB, which exceeds the recommended limit of ${formatNumber( - maxMemorySize - )} MB. Are you sure you want to proceed with the deployment?` - ); + const errorText = `⚠️ Your satellite's heap memory is ${formatNumber( + heap + )} MB, which exceeds the enforced limit of ${formatNumber(maxMemorySize)} MB.`; + + if (isHeadless()) { + console.log(yellow(errorText)); + process.exit(1); + } + + await confirmAndExit(`${errorText} Are you sure you want to proceed with the deployment?`); };