diff --git a/lib/debug.py b/lib/debug.py index 453f9d39..c45de1f3 100644 --- a/lib/debug.py +++ b/lib/debug.py @@ -63,9 +63,11 @@ class ViewcvsException: return "ViewCVS Unrecoverable Error" def PrintStackTrace(text = ""): + import sys import traceback import string import sapi + print "

", text, "

\n

"
   print sapi.server.escape(string.join(traceback.format_stack(), ''))
   print "

" @@ -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 "
Child Process", i, "
" print "" diff --git a/lib/popen.py b/lib/popen.py index d353a863..b9232a1d 100644 --- a/lib/popen.py +++ b/lib/popen.py @@ -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