diff options
| author | Karel Klic <kklic@redhat.com> | 2010-05-04 19:02:57 +0200 |
|---|---|---|
| committer | Nikola Pajkovsky <npajkovs@redhat.com> | 2010-05-12 15:44:49 +0200 |
| commit | 91c7c2ee8fa9ab6c29a7ddc64cff1fa9f5e2918a (patch) | |
| tree | 3f3a6e6c6725f031367420088ea9fe3b8bf5ed72 /src/Hooks | |
| parent | 94a67f5d3edd6ac842cc3d7feea9e1954ee58a37 (diff) | |
Daemon socket for reporting crashes
Diffstat (limited to 'src/Hooks')
| -rw-r--r-- | src/Hooks/Makefile.am | 5 | ||||
| -rw-r--r-- | src/Hooks/abrt_exception_handler.py.in | 26 |
2 files changed, 20 insertions, 11 deletions
diff --git a/src/Hooks/Makefile.am b/src/Hooks/Makefile.am index ef4ab821..3c8aeb94 100644 --- a/src/Hooks/Makefile.am +++ b/src/Hooks/Makefile.am @@ -47,9 +47,10 @@ EXTRA_DIST = abrt_exception_handler.py.in $(man_MANS) CLEANFILES := $(notdir $(wildcard *~)) $(notdir $(wildcard *\#)) $(notdir $(wildcard \.\#*)) $(notdir $(wildcard *.pyc)) +# Must be synchronized with another sed call below. abrt_exception_handler.py: - sed s,@DEBUG_DUMP_DIR@,$(DEBUG_DUMPS_DIR),g abrt_exception_handler.py.in > abrt_exception_handler.py + sed s,\@VAR_RUN\@,\"$(VAR_RUN)\",g abrt_exception_handler.py.in > abrt_exception_handler.py # RPM fix: we need to regenerate abrt_exception_handler.py, because it has the default ddir install-data-local: - sed s,@DEBUG_DUMP_DIR@,$(DEBUG_DUMPS_DIR),g abrt_exception_handler.py.in > abrt_exception_handler.py + sed s,\@VAR_RUN\@,\"$(VAR_RUN)\",g abrt_exception_handler.py.in > abrt_exception_handler.py diff --git a/src/Hooks/abrt_exception_handler.py.in b/src/Hooks/abrt_exception_handler.py.in index 8a5d8060..e4c97a94 100644 --- a/src/Hooks/abrt_exception_handler.py.in +++ b/src/Hooks/abrt_exception_handler.py.in @@ -19,13 +19,14 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ -Module for a userfriendly exception handling +Module for a ABRT exception handling hook """ import sys import os import syslog import subprocess +import socket def write_dump(pid, tb): executable = "Exception raised from python shell" @@ -35,14 +36,21 @@ def write_dump(pid, tb): # during execution? executable = os.path.abspath(sys.argv[0]) - command = ["/usr/libexec/abrt-hook-python"] - command.append("--pid=%s" % pid) - command.append("--executable=%s" % executable) - - helper = subprocess.Popen(command, stdin=subprocess.PIPE) - helper.communicate(tb) - helper.wait() - + # Open ABRT daemon's socket and write data to it. + s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + s.connect(@VAR_RUN@ + "/abrt.socket") + s.sendall("NEW\0") + s.sendall("PID=%s\0" % pid) + s.sendall("EXECUTABLE=%s\0" % executable) + s.sendall("BACKTRACE=%s\0" % tb) + s.sendall("ANALYZER=Python\0") + s.sendall("BASENAME=pyhook\0") + # This handler puts a short(er) crash descr in 1st line of the backtrace. + # Example: + # CCMainWindow.py:1:<module>:ZeroDivisionError: integer division or modulo by zero + s.sendall("REASON=%s\0" % tb.splitlines()[0]) + s.sendall("DONE\0") + s.close() def handleMyException((etype, value, tb)): """ |
