From b9a85a8dfa67aef7ce92daefbc2736a4e01fb1aa Mon Sep 17 00:00:00 2001
From: Robi Nino <robin@jfrog.com>
Date: Thu, 5 Sep 2024 13:45:41 +0300
Subject: [PATCH] Avoid throwing on JFrog CLI failures (#210)

---
 lib/utils.js | 4 ++--
 src/utils.ts | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/utils.js b/lib/utils.js
index 9cecf8908..3e297d80f 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -408,9 +408,9 @@ class Utils {
      */
     static runCli(args, options) {
         return __awaiter(this, void 0, void 0, function* () {
-            let res = yield (0, exec_1.exec)('jf', args, options);
+            let res = yield (0, exec_1.exec)('jf', args, Object.assign(Object.assign({}, options), { ignoreReturnCode: true }));
             if (res !== core.ExitCode.Success) {
-                throw new Error('JFrog CLI exited with exit code ' + res);
+                throw new Error('JFrog CLI exited with exit code: ' + res);
             }
         });
     }
diff --git a/src/utils.ts b/src/utils.ts
index a6adbe2e9..c36c28c52 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -462,9 +462,9 @@ export class Utils {
      * @param options - Execution options
      */
     public static async runCli(args: string[], options?: ExecOptions) {
-        let res: number = await exec('jf', args, options);
+        let res: number = await exec('jf', args, { ...options, ignoreReturnCode: true });
         if (res !== core.ExitCode.Success) {
-            throw new Error('JFrog CLI exited with exit code ' + res);
+            throw new Error('JFrog CLI exited with exit code: ' + res);
         }
     }