#!/usr/bin/python # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # Copyright 2005 Dan Williams and Red Hat, Inc. import socket import sys, os if len(sys.argv) < 2: print "Need the address to grab traceback from." os._exit(1) addr = sys.argv[1] s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) s.connect(addr) s.settimeout(2.0) tb = '' while True: try: text = s.recv(1000) if len(text) == 0: break tb = tb + text except socket.error, e: if e[0] == 11: # Resource temporarily unavailable continue break print tb s.close()