aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjwbernin <jwbernin@ef72aa8b-4018-0410-8976-d6e080ef94d8>2007-02-17 14:53:50 +0000
committerjwbernin <jwbernin@ef72aa8b-4018-0410-8976-d6e080ef94d8>2007-02-17 14:53:50 +0000
commit2c0f5c3c80cd1bf8a53b8100055942843f76fae7 (patch)
tree391455ec323b1c0e34c0735ba26572ecfc9cfe89 /src
parent4e52ef7987af2d3f7ea934c4bbb0c675733b5791 (diff)
downloadsos-2c0f5c3c80cd1bf8a53b8100055942843f76fae7.tar.gz
First stage interrupt / ^C handling
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@78 ef72aa8b-4018-0410-8976-d6e080ef94d8
Diffstat (limited to 'src')
-rw-r--r--src/lib/sos/plugintools.py39
-rwxr-xr-xsrc/sosreport5
2 files changed, 40 insertions, 4 deletions
diff --git a/src/lib/sos/plugintools.py b/src/lib/sos/plugintools.py
index d3b7a9d7..096cbfdc 100644
--- a/src/lib/sos/plugintools.py
+++ b/src/lib/sos/plugintools.py
@@ -79,7 +79,12 @@ class PluginBase:
fp.write(tmpout)
fp.close()
return occurs
- except:
+ except SystemExit:
+ raise SystemExit
+ except KeyboardInterrupt:
+ raise KeyboardInterrupt
+ except Exception, e:
+ print e
sys.stderr.write("Problem at path %s\n" % abspath)
sys.stderr.flush()
break
@@ -132,7 +137,12 @@ class PluginBase:
else:
try:
abspath = self.doCopyFileOrDir(srcpath+'/'+afile)
- except:
+ except SystemExit:
+ raise SystemExit
+ except KeyboardInterrupt:
+ raise KeyboardInterrupt
+ except Exception, e:
+ print e
sys.stderr.write("1Problem at path %s\n" % srcpath+'/'+afile)
sys.stderr.flush()
# if on forbidden list, abspath is null
@@ -143,7 +153,12 @@ class PluginBase:
try:
dstslname, abspath = self.__copyFile(srcpath)
self.copiedFiles.append({'srcpath':srcpath, 'dstpath':dstslname, 'symlink':"yes", 'pointsto':link})
- except:
+ except SystemExit:
+ raise SystemExit
+ except KeyboardInterrupt:
+ raise KeyboardInterrupt
+ except Exception, e:
+ print e
sys.stderr.write("2Problem at path %s\n" % srcpath)
sys.stderr.flush()
@@ -152,7 +167,13 @@ class PluginBase:
newpath = os.path.normpath(os.path.join(os.path.dirname(srcpath), link))
try:
self.doCopyFileOrDir(newpath)
+ except SystemExit:
+ raise SystemExit
+ except KeyboardInterrupt:
+ raise KeyboardInterrupt
except EnvironmentError, (errno, strerror):
+ print errno
+ print strerror
if (errno != 17):
# we ignore 'file exists' errors
sys.stderr.write("3Problem at path %s\n" % newpath)
@@ -187,6 +208,10 @@ class PluginBase:
abspath = os.path.join(self.cInfo['dstroot'], src.lstrip(os.path.sep))
relpath = sosRelPath(self.cInfo['rptdir'], abspath)
return relpath, abspath
+ except SystemExit:
+ raise SystemExit
+ except KeyboardInterrupt:
+ raise KeyboardInterrupt
except Exception,e:
sys.stderr.write("4Problem copying file %s\n" % src,)
print e
@@ -345,6 +370,10 @@ class PluginBase:
for path in self.copyPaths:
try:
self.doCopyFileOrDir(path)
+ except SystemExit:
+ raise SystemExit
+ except KeyboardInterrupt:
+ raise KeyboardInterrupt
except Exception, e:
sys.stderr.write("Error copying from pathspec %s\n" % path,)
print e
@@ -352,6 +381,10 @@ class PluginBase:
for prog in self.collectProgs:
try:
self.collectOutputNow(prog)
+ except SystemExit:
+ raise SystemExit
+ except KeyboardInterrupt:
+ raise KeyboardInterrupt
except:
sys.stderr.write("Error collecting output of '%s'\n" % prog,)
sys.stderr.flush()
diff --git a/src/sosreport b/src/sosreport
index 45625ea9..ba5781af 100755
--- a/src/sosreport
+++ b/src/sosreport
@@ -56,8 +56,11 @@ def doExitCode():
if ( ( activeCount() == 1 ) and ( __breakHits__ > 2 ) ):
print "Multiple SIGTERMs, single thread, exiting without cleaning up."
sys.exit(3)
+
+
# FIXME: Add code here to clean up /tmp
- sys.exit(255)
+ print "Calling sys.exit from doExitCode()"
+ sys.exit("Abnormal exit")
# Handle any sort of exit signal cleanly
# Currently, we intercept only sig 15 (TERM)