From 6ac36aacaaf67b6222c91584c367ef3c49c01069 Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Thu, 14 Dec 2023 08:08:04 -0800 Subject: [PATCH] fix: check oclif exit code first (#466) * fix: check oclif exit code first * ci: rm cli-plugins-testkit for external nuts --- .github/workflows/test.yml | 2 +- src/sfCommand.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bc2c9b82..df4c3c15 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,7 +38,7 @@ jobs: with: packageName: '@salesforce/sf-plugins-core' externalProjectGitUrl: 'https://github.com/salesforcecli/plugin-deploy-retrieve' - preBuildCommands: 'shx rm -rf node_modules/@oclif/core; shx rm -rf node_modules/@salesforce/kit; shx rm -rf node_modules/@salesforce/core; shx rm -rf node_modules/@salesforce/ts-types' + preBuildCommands: 'shx rm -rf node_modules/@oclif/core; shx rm -rf node_modules/@salesforce/kit; shx rm -rf node_modules/@salesforce/core; shx rm -rf node_modules/@salesforce/ts-types; shx rm -rf node_modules/@salesforce/cli-plugins-testkit' command: ${{ matrix.command }} os: ${{ matrix.os }} secrets: inherit diff --git a/src/sfCommand.ts b/src/sfCommand.ts index 737a2184..2e375c0b 100644 --- a/src/sfCommand.ts +++ b/src/sfCommand.ts @@ -429,7 +429,7 @@ export abstract class SfCommand extends Command { // @ts-expect-error because exitCode is not on Error // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access - const codeFromError = (error.exitCode as number | undefined) ?? (error.oclif?.exit as number | undefined) ?? 1; + const codeFromError = (error.oclif?.exit as number | undefined) ?? (error.exitCode as number | undefined) ?? 1; process.exitCode ??= codeFromError; const sfErrorProperties = removeEmpty({