- fixed debug.PrintStackTrace() function

- updated child process tracker to use the sapi.server.pageGlobals dictionary


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@601 8cb11bc2-c004-0410-86c3-e597b4017df7
remotes/tags/1.0.0-rc1
rey4 2003-02-11 02:58:04 +00:00
parent 8ad4c2657e
commit d8b66eebde
2 changed files with 20 additions and 7 deletions

View File

@ -63,9 +63,11 @@ class ViewcvsException:
return "ViewCVS Unrecoverable Error"
def PrintStackTrace(text = ""):
import sys
import traceback
import string
import sapi
print "<hr><p><font color=red>", text, "</font></p>\n<p><pre>"
print sapi.server.escape(string.join(traceback.format_stack(), ''))
print "</pre></p>"
@ -98,19 +100,28 @@ if SHOW_CHILD_PROCESSES:
self.debugIn = inStream
self.debugOut = outStream
self.debugErr = errStream
import sapi
if not sapi.server.pageGlobals.has_key('processes'):
sapi.server.pageGlobals['processes'] = [self]
else:
sapi.server.pageGlobals['processes'].append(self)
def printInfo(self):
print "Command Line", command
def DumpChildren():
import sapi, sys
server = sapi.server.self()
if not server.pageGlobals.has_key('processes'):
return
server.header()
lastOut = None
server.header()
i = 0
for k in server.processes:
for k in server.pageGlobals['processes']:
i += 1
print "<div align=center>Child Process", i, "</div>"
print "<table border=1>"

View File

@ -34,9 +34,11 @@ if sys.platform == "win32":
def popen(cmd, args, mode, capture_err=1):
if sys.platform == "win32":
command = win32popen.CommandLine(cmd, args)
#sapi.server.header()
#debug.PrintStackTrace(command)
if mode.find('r') >= 0:
hStdIn = None
@ -72,7 +74,7 @@ def popen(cmd, args, mode, capture_err=1):
phandle, pid, thandle, tid = win32popen.CreateProcess(command, hStdIn, hStdOut, hStdErr)
if debug.SHOW_CHILD_PROCESSES:
sapi.server.processes.append(debug.Process(command, dbgIn, dbgOut, dbgErr))
debug.Process(command, dbgIn, dbgOut, dbgErr)
return _pipe(win32popen.File2FileObject(handle, mode), phandle)
@ -166,7 +168,7 @@ def pipe_cmds(cmds):
command = win32popen.CommandLine(cmd[0], cmd[1:])
phandle, pid, thandle, tid = win32popen.CreateProcess(command, hStdIn, hStdOut, None)
if debug.SHOW_CHILD_PROCESSES:
sapi.server.processes.append(debug.Process(command, dbgIn, dbgOut, dbgErr))
debug.Process(command, dbgIn, dbgOut, dbgErr)
dbgIn = dbgOut
hStdIn = nextStdIn