From: Oleg Broytman Date: Sat, 22 Dec 2007 23:17:53 +0000 (+0000) Subject: Redirect subprocess' stderr to my stderr. X-Git-Tag: v4.5.3~249 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=780df49722c299d6bfa58765ef13659b765f1354;p=bookmarks_db.git Redirect subprocess' stderr to my stderr. git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@127 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- diff --git a/Robots/bkmk_rforking.py b/Robots/bkmk_rforking.py index da257f6..d3d3351 100644 --- a/Robots/bkmk_rforking.py +++ b/Robots/bkmk_rforking.py @@ -14,8 +14,8 @@ except ImportError: import sys, os from subproc import Subprocess, RecordFile -# This is to catch 'close failed: [Errno 9] Bad file descriptor' -# message from os.close() in Subprocess.die(). +# This is to catch 'close failed: [Errno 9] Bad file descriptor' message +# from os.close() in Subprocess.die(). sys.stderr = open("err.log", 'w') check_subp = None @@ -32,7 +32,8 @@ def restart_subp(log): global check_subp, subp_pipe stop_subp(log) - check_subp = Subprocess("%s/Robots/bkmk_rforking_sub.py" % os.path.dirname(sys.argv[0])) + check_subp = Subprocess("%s/Robots/bkmk_rforking_sub.py" % os.path.dirname(sys.argv[0]), + control_stderr=True) subp_pipe = RecordFile(check_subp) @@ -63,6 +64,12 @@ class robot_forking(Robot): bookmark.parent = save_parent + while True: + error = check_subp.readPendingErrLine() + if not error: + break + sys.stderr.write(error) + except KeyboardInterrupt: return 0