aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorshnavid <shnavid@ef72aa8b-4018-0410-8976-d6e080ef94d8>2007-07-13 13:14:40 +0000
committershnavid <shnavid@ef72aa8b-4018-0410-8976-d6e080ef94d8>2007-07-13 13:14:40 +0000
commitc49655190cec3ad3e1b57675c3c797ec48bd5f7d (patch)
tree0087800fd8ecfd483edef73cbd93ceb4ff30b878 /src/lib
parent597b3055be7d9aed1cf69f171d632e3d14837e9b (diff)
downloadsos-c49655190cec3ad3e1b57675c3c797ec48bd5f7d.tar.gz
* resized progressbar to 40 chars
* progressbar fixes * increased logging for threading * improved command output filename mangling git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@201 ef72aa8b-4018-0410-8976-d6e080ef94d8
Diffstat (limited to 'src/lib')
-rwxr-xr-xsrc/lib/sos/helpers.py2
-rw-r--r--src/lib/sos/plugintools.py17
2 files changed, 12 insertions, 7 deletions
diff --git a/src/lib/sos/helpers.py b/src/lib/sos/helpers.py
index 09bb356f..2e553a1f 100755
--- a/src/lib/sos/helpers.py
+++ b/src/lib/sos/helpers.py
@@ -64,7 +64,7 @@ def sosGetCommandOutput(command):
stime = time()
errdata = ''
status,outdata=commands.getstatusoutput(command)
- return (status, ''.join(outdata), time()-stime)
+ return (status, outdata, time()-stime)
# this needs to be made clean and moved to the plugin tools, so
diff --git a/src/lib/sos/plugintools.py b/src/lib/sos/plugintools.py
index b403af4e..1dac3987 100644
--- a/src/lib/sos/plugintools.py
+++ b/src/lib/sos/plugintools.py
@@ -294,16 +294,21 @@ class PluginBase:
def makeCommandFilename(self, exe):
""" The internal function to build up a filename based on a command """
- # build file name for output
- rawcmd = os.path.basename(exe).strip()
- mangledname = re.sub(r"[^\w-]+", "_", rawcmd)[0:32]
+ mangledname = re.sub(r"[^\w\-\.\/]+", "_", exe)
+ mangledname = re.sub(r"/", ".", mangledname).strip(" ._-")[0:64]
outfn = self.cInfo['cmddir'] + "/" + self.piName + "/" + mangledname
# check for collisions
- while os.path.exists(outfn):
- outfn = outfn + "z"
+ inc = 0
+ if os.path.exists(outfn):
+ inc = 2
+ while True:
+ newfn = outfn + "_" + inc
+ if not os.path.exists(newfn):
+ break
+ inc +=1
return outfn
@@ -328,7 +333,7 @@ class PluginBase:
os.mkdir(os.path.dirname(outfn))
outfd = open(outfn, "w")
- outfd.write(shout)
+ if len(shout): outfd.write(shout+"\n")
outfd.close()
if root_symlink: