[bitbake-devel,v2] bitbake-layers: add signal hander to avoid exception

Submitted by Zhixiong Chi on April 12, 2017, 3:29 a.m. | Patch ID: 139060

Details

Message ID 1491967757-28627-1-git-send-email-zhixiong.chi@windriver.com
State New
Headers show

Commit Message

Zhixiong Chi April 12, 2017, 3:29 a.m.
Fixed:
bitbake-layers show-recipes | less
press "q" to exit

There will be a Broken pipe error output as follows:
"BrokenPipeError: [Errno 32] Broken pipe"

Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
---
 bin/bitbake-layers | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

diff --git a/bin/bitbake-layers b/bin/bitbake-layers
index 390ad05..2b05d28 100755
--- a/bin/bitbake-layers
+++ b/bin/bitbake-layers
@@ -24,6 +24,7 @@  import logging
 import os
 import sys
 import argparse
+import signal
 
 bindir = os.path.dirname(__file__)
 topdir = os.path.dirname(bindir)
@@ -35,6 +36,7 @@  import bb.msg
 logger = bb.msg.logger_create('bitbake-layers', sys.stdout)
 
 def main():
+    signal.signal(signal.SIGPIPE, signal.SIG_DFL)
     parser = argparse.ArgumentParser(
         description="BitBake layers utility",
         epilog="Use %(prog)s <subcommand> --help to get help on a specific command",