From 06fef5e0197dbcec3655fe76874844e701de992f Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Thu, 7 Oct 2010 16:58:41 +0200
Subject: [PATCH] gnt-job cancel: Use non-zero exit status if canceling failed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This allows the use β€œgnt-job cancel” in scripts.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 scripts/gnt-job | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/scripts/gnt-job b/scripts/gnt-job
index 80dbfd8b8..8924c3edd 100755
--- a/scripts/gnt-job
+++ b/scripts/gnt-job
@@ -176,13 +176,17 @@ def CancelJobs(opts, args):
 
   """
   client = GetClient()
+  result = constants.EXIT_SUCCESS
 
   for job_id in args:
-    (_, msg) = client.CancelJob(job_id)
+    (success, msg) = client.CancelJob(job_id)
+
+    if not success:
+      result = constants.EXIT_FAILURE
+
     ToStdout(msg)
 
-  # TODO: Different exit value if not all jobs were canceled?
-  return 0
+  return result
 
 
 def ShowJobs(opts, args):
-- 
GitLab