[pypy-svn] r62864 - pypy/trunk/dotviewer

afa at codespeak.net afa at codespeak.net
Wed Mar 11 19:58:16 CET 2009


Author: afa
Date: Wed Mar 11 19:58:14 2009
New Revision: 62864

Modified:
   pypy/trunk/dotviewer/graphclient.py
   pypy/trunk/dotviewer/msgstruct.py
Log:
graphviewer now uses the subprocess module instead of os.popen2.
This works on Windows.
And no need to hack the file mode any more :-)


Modified: pypy/trunk/dotviewer/graphclient.py
==============================================================================
--- pypy/trunk/dotviewer/graphclient.py	(original)
+++ pypy/trunk/dotviewer/graphclient.py	Wed Mar 11 19:58:14 2009
@@ -1,4 +1,5 @@
 import os, sys, re
+import subprocess
 import msgstruct
 
 this_dir = os.path.dirname(os.path.abspath(__file__))
@@ -130,7 +131,9 @@
     else:
         python = sys.executable
     cmdline = '"%s" -u "%s" --stdio' % (python, GRAPHSERVER)
-    child_in, child_out = os.popen2(cmdline, 'tb')
+    p = subprocess.Popen(cmdline,
+                         stdout=subprocess.PIPE, stdin=subprocess.PIPE)
+    child_in, child_out = p.stdin, p.stdout
     io = msgstruct.FileIO(child_out, child_in)
     return io
 

Modified: pypy/trunk/dotviewer/msgstruct.py
==============================================================================
--- pypy/trunk/dotviewer/msgstruct.py	(original)
+++ pypy/trunk/dotviewer/msgstruct.py	Wed Mar 11 19:58:14 2009
@@ -84,10 +84,6 @@
 
 class FileIO(IO):
     def __init__(self, f_in, f_out):
-        if sys.platform == 'win32':
-            import msvcrt
-            msvcrt.setmode(f_in.fileno(), os.O_BINARY)
-            msvcrt.setmode(f_out.fileno(), os.O_BINARY)
         self.f_in = f_in
         self.f_out = f_out
 



More information about the Pypy-commit mailing list