chiark / gitweb /
Allow only certain gitk exit codes as valid
authorCatalin Marinas <catalin.marinas@gmail.com>
Sat, 8 Dec 2007 23:16:30 +0000 (23:16 +0000)
committerCatalin Marinas <catalin.marinas@gmail.com>
Sat, 8 Dec 2007 23:19:03 +0000 (23:19 +0000)
This patch fixes the log and series commands to not report an error when
gitk is killed by the user.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
stgit/commands/log.py
stgit/commands/series.py

index c5f71a24509061cc81804145924a40b34416f2c6..52d55a531b0af6a5b32b3afc349f0b32c09cca3a 100644 (file)
@@ -141,6 +141,7 @@ def func(parser, options, args):
         raise CmdException, 'No changelog for patch "%s"' % name
 
     if options.graphical:
-        Run('gitk', log).discard_exitcode().run()
+        # discard the exit codes generated by SIGINT, SIGKILL, SIGTERM
+        Run('gitk', log).returns([0, -2, -9, -15]).run()
     else:
         show_log(log, options)
index 4c6d07e709ccd3396de2381e1c237ced7f37378e..3c0816e3c8d6f0d4ef45e4cf13d0a4e873756892 100644 (file)
@@ -194,18 +194,17 @@ def func(parser, options, args):
         if options.missing:
             raise CmdException, '--graphical not supported with --missing'
 
+        gitk_args = []
         if applied:
-            gitk_args = ' %s^..%s' % (git_id(crt_series, applied[0]),
-                                      git_id(crt_series, applied[-1]))
-        else:
-            gitk_args = ''
-
+            gitk_args.append('%s^..%s'
+                             % (git_id(crt_series, applied[0]),
+                                git_id(crt_series, applied[-1])))
         for p in unapplied:
             patch_id = git_id(crt_series, p)
-            gitk_args += ' %s^..%s' % (patch_id, patch_id)
+            gitk_args.append('%s^..%s' % (patch_id, patch_id))
 
-        if os.system('gitk%s' % gitk_args) != 0:
-            raise CmdException, 'gitk execution failed'
+        # discard the exit codes generated by SIGINT, SIGKILL, SIGTERM
+        Run('gitk', *gitk_args).returns([0, -2, -9, -15]).run()
     else:
         max_len = 0
         if len(patches) > 0: