Changeset 3819:4fa486a9d4d7 in livinglogic.python.xist

Show
Ignore:
Timestamp:
07/01/09 22:17:54 (10 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Update html.astext() to use the subprocess module instead of os.popen2().

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/ll/xist/ns/html.py

    r3795 r3819  
    1717 
    1818 
    19 import os, cgi, contextlib, operator 
     19import os, cgi, contextlib, subprocess 
    2020 
    2121from ll import url, misc 
     
    13801380 
    13811381    cmd = "elinks %s" % " ".join(options) 
    1382     (stdin, stdout) = os.popen2(cmd) 
    1383  
    1384     stdin.write(text) 
    1385     stdin.close() 
    1386     text = stdout.read() 
    1387     stdout.close() 
     1382    p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True) 
     1383    p.stdin.write(text) 
     1384    p.stdin.close() 
     1385    text = p.stdout.read() 
     1386    p.stdout.close() 
    13881387    text = "\n".join(line.rstrip() for line in text.splitlines()) 
    13891388    return text