Patchwork [bitbake-devel,2/3] bitbake/knotty: ensure we return non-zero exit code on Ctrl+C

login
register
mail settings
Submitter Paul Eggleton
Date Feb. 13, 2012, 11:41 a.m.
Message ID <b0e42ae76c528cf90d3a78acfe8b4cd6b8552d42.1329133148.git.paul.eggleton@linux.intel.com>
Download mbox | patch
Permalink /patch/21185/
State New
Headers show

Comments

Paul Eggleton - Feb. 13, 2012, 11:41 a.m.
If the user uses Ctrl+C to exit out of the build, then ensure we return
a non-zero exit code since the entire build was not completed
successfully.

If nothing else, this is useful to avoid continuing in the bitbake
wrapper script in OE-Core if the initial pseudo build is interrupted.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 bitbake/lib/bb/ui/knotty.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
Paul Eggleton - Feb. 22, 2012, 9:14 p.m.
On Monday 13 February 2012 11:41:32 Paul Eggleton wrote:
> If the user uses Ctrl+C to exit out of the build, then ensure we return
> a non-zero exit code since the entire build was not completed
> successfully.
> 
> If nothing else, this is useful to avoid continuing in the bitbake
> wrapper script in OE-Core if the initial pseudo build is interrupted.
> 
> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
> ---
>  bitbake/lib/bb/ui/knotty.py |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
> index e1d42f7..2693a78 100644
> --- a/bitbake/lib/bb/ui/knotty.py
> +++ b/bitbake/lib/bb/ui/knotty.py
> @@ -296,4 +296,9 @@ def main(server, eventHandler):
>      if summary:
>          print(summary)
> 
> +    if shutdown:
> +        print("Execution was interrupted, returning a non-zero exit code.")
> +        if return_value == 0:
> +            return_value = 1
> +
>      return return_value

Seems I didn't test this well enough. Working on a fix right now.

Cheers,
Paul

Patch

diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index e1d42f7..2693a78 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -296,4 +296,9 @@  def main(server, eventHandler):
     if summary:
         print(summary)
 
+    if shutdown:
+        print("Execution was interrupted, returning a non-zero exit code.")
+        if return_value == 0:
+            return_value = 1
+
     return return_value