Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 050015d

Browse files
committed
minor adjustments
1 parent 5a5b31a commit 050015d

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

lib/core/common.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,14 +1109,16 @@ def profile(profileOutputFile=None, imageOutputFile=None):
11091109

11101110
cProfile.run("start()", profileOutputFile)
11111111

1112-
infoMsg = "converting profile data into a graph image, %s" % imageOutputFile
1112+
infoMsg = "converting profile data into a graph image '%s'" % imageOutputFile
11131113
logger.info(infoMsg)
11141114

11151115
graphScriptPath = os.path.join(paths.SQLMAP_EXTRAS_PATH, 'gprof2dot', 'gprof2dot.py')
1116-
stderr = execute('%s %s -f pstats %s | dot -Tpng -o %s' % (sys.executable, graphScriptPath, profileOutputFile, imageOutputFile), shell=True, stderr=PIPE).stderr.read()
1116+
process = execute('%s %s -f pstats %s | dot -Tpng -o %s' % (sys.executable, graphScriptPath, profileOutputFile, imageOutputFile), shell=True, stdout=None, stderr=PIPE)
1117+
pollProcess(process)
1118+
payloadStderr = process.communicate()[1]
11171119

1118-
if stderr or not os.path.exists(imageOutputFile):
1119-
errMsg = "there was an error while converting ('%s')" % stderr.strip()
1120+
if payloadStderr or not os.path.exists(imageOutputFile):
1121+
errMsg = "there was an error while converting ('%s'), " % payloadStderr.strip()
11201122
errMsg += "but you can still find raw profile data "
11211123
errMsg += "inside file '%s'" % profileOutputFile
11221124
logger.error(errMsg)

0 commit comments

Comments
 (0)