backports: lib: remove raising ExecutionError exception
authorArend van Spriel <arend@broadcom.com>
Fri, 2 May 2014 01:03:37 +0000 (18:03 -0700)
committerLuis R. Rodriguez <mcgrof@do-not-panic.com>
Fri, 2 May 2014 01:44:14 +0000 (18:44 -0700)
In spatch a ExecutionError was raised, but that causes the thread
to finish without closing the outfile and more importantly without
putting (ret, fn) tuple on the return queue. This results in the
threaded_spatch routine to get stuck on the ret_q.get() call. This
patch removes raising the ExecutionError and just return the tuple.
The non-zero return code will result in ExecutionErrorThread exception
anyway.

Signed-off-by: Arend van Spriel <arend@broadcom.com>
[mcgrof]: rebased to fit into pycocci
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
devel/pycocci

index fde81903b29fbe9771a325e85de04816dd75cd3b..b6bb78ebf972f1b45862293c358cfea7c3c09ee6 100755 (executable)
@@ -41,11 +41,6 @@ class tempdir(object):
 
 class CoccinelleError(Exception):
     pass
-class ExecutionError(CoccinelleError):
-    def __init__(self, cmd, errcode):
-        self.error_code = errcode
-        print('Failed command:')
-        print(' '.join(cmd))
 
 class ExecutionErrorThread(CoccinelleError):
     def __init__(self, errcode, fn, cocci_file, threads, t, logwrite, print_name):
@@ -92,8 +87,6 @@ def spatch(cocci_file, outdir,
                                stdout=outfile, stderr=subprocess.STDOUT,
                                close_fds=True, universal_newlines=True)
     sprocess.wait()
-    if sprocess.returncode != 0:
-        raise ExecutionError(cmd, sprocess.returncode)
     outfile.close()
     ret_q.put((sprocess.returncode, fn))