Skip to contentSkip to conversation

bitbake-layers: add signal hander to avoid exception

PATCH Zhixiong Chi 3 participants 4 messages Apr 10, 2017 – Apr 12, 2017

lore
Share & tools
lore
#0 lore raw

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"

---
 bin/bitbake-layers | 2 ++
 1 file changed, 2 insertions(+)
bin/bitbake-layers +2 -0
index 390ad05..d58022d 100755
@@ -20,6 +20,7 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
+from signal import signal, SIGPIPE, SIG_DFL
 import logging
 import os
 import sys
@@ -35,6 +36,7 @@ import bb.msg
 logger = bb.msg.logger_create('bitbake-layers', sys.stdout)
 
 def main():
+    signal(SIGPIPE, SIG_DFL)
     parser = argparse.ArgumentParser(
         description="BitBake layers utility",
         epilog="Use %(prog)s <subcommand> --help to get help on a specific command",
Signature · 1 line
1.9.1
#1 lore raw
Quoted 20 lines · Zhixiong Chi

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"

---
 bin/bitbake-layers | 2 ++

 1 file changed, 2 insertions(+)
bin/bitbake-layers +0 -0
index 390ad05..d58022d 100755
@@ -20,6 +20,7 @@
  # with this program; if not, write to the Free Software Foundation,
 Inc.,
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Quoted 2 lines


+from signal import signal, SIGPIPE, SIG_DFL

Stylistically, we tend to do:

import signal

signal.signal(signal.SIGPIPE, signal.SIG_DFL)

so I've a small preference for that. I discussed this with Paul and we think other bitbake tools may also have this issue. We wondered if it was possible to do something more centrally in bitbake, and/or fix the other tools at the same time.

Any thoughts on that?

Cheers,

Richard

Quoted 15 lines

 import logging
 import os
 import sys

bin/bitbake-layers +0 -0
@@ -35,6 +36,7 @@ import bb.msg
  logger = bb.msg.logger_create('bitbake-layers', sys.stdout)


 def main():
+    signal(SIGPIPE, SIG_DFL)
     parser = argparse.ArgumentParser( description="BitBake layers utility", epilog="Use %(prog)s <subcommand> --help to get help on a specific command",
--
1.9.1

#2 lore raw
Quoted 22 lines · Richard Purdie
Quoted 21 lines · Zhixiong Chi

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"

---
  bin/bitbake-layers | 2 ++
  1 file changed, 2 insertions(+)
bin/bitbake-layers +0 -0
index 390ad05..d58022d 100755
@@ -20,6 +20,7 @@
  # with this program; if not, write to the Free Software Foundation,
 Inc.,
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
Quoted 6 lines

bin/bitbake-layers line 23

Quoted 1 line
bin/bitbake-layers +1 -0
+from signal import signal, SIGPIPE, SIG_DFL

Stylistically, we tend to do:

import signal

signal.signal(signal.SIGPIPE, signal.SIG_DFL)

Thanks for your suggestion, I will send v2 patch later.

Quoted 7 lines

so I've a small preference for that. I discussed this with Paul and we think other bitbake tools may also have this issue. We wondered if it was possible to do something more centrally in bitbake, and/or fix the other tools at the same time.

Any thoughts on that?

I agree with this, unfortunately out testing team haven't met this issue in other bitbake tools yet.

Thanks.

Quoted 20 lines

Cheers,

Richard

Quoted 15 lines
bin/bitbake-layers +0 -0
  import logging
  import os

import sys

bin/bitbake-layers +1 -0
@@ -35,6 +36,7 @@ import bb.msg
  logger = bb.msg.logger_create('bitbake-layers', sys.stdout)
 
  def main():
+    signal(SIGPIPE, SIG_DFL)
      parser = argparse.ArgumentParser(
          description="BitBake layers utility",
          epilog="Use %(prog)s <subcommand> --help to get help on a

specific command",

Signature · 1 line
1.9.1
Signature · 4 lines
---------------------
Thanks,
Zhixiong Chi
Tel: +86-10-8477-7036
#3 lore raw
Quoted 10 lines · NZST Zhixiong Chi
Quoted 6 lines · Richard Purdie

I discussed this with Paul and we
think other bitbake tools may also have this issue. We wondered if it was possible to do something more centrally in bitbake, and/or fix the other tools at the same time.

Any thoughts on that?

I agree with this, unfortunately out testing team haven't met this issue in other bitbake tools yet.

FYI bitbake -e | less and then quit will trigger it with bitbake itself.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre