]> git.phdru.name Git - bookmarks_db.git/commitdiff
Redirect subprocess' stderr to my stderr.
authorOleg Broytman <phd@phdru.name>
Sat, 22 Dec 2007 23:17:53 +0000 (23:17 +0000)
committerOleg Broytman <phd@phdru.name>
Sat, 22 Dec 2007 23:17:53 +0000 (23:17 +0000)
git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@127 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23

Robots/bkmk_rforking.py

index da257f6cecba0d741dc6589c87d6a5fa4299d200..d3d33511aff322e2a148c48e8f57e0e162cf9d68 100644 (file)
@@ -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