From: <pj...@us...> - 2010-04-04 00:17:05
|
Revision: 6999 http://jython.svn.sourceforge.net/jython/?rev=6999&view=rev Author: pjenvey Date: 2010-04-04 00:16:58 +0000 (Sun, 04 Apr 2010) Log Message: ----------- os.popen files should use text mode fixes #1566 Modified Paths: -------------- trunk/jython/Lib/os.py trunk/jython/NEWS Modified: trunk/jython/Lib/os.py =================================================================== --- trunk/jython/Lib/os.py 2010-04-02 16:15:48 UTC (rev 6998) +++ trunk/jython/Lib/os.py 2010-04-04 00:16:58 UTC (rev 6999) @@ -678,11 +678,14 @@ if mode == 'r': proc = subprocess.Popen(cmd, bufsize=bufsize, shell=True, stdout=subprocess.PIPE) - return _wrap_close(proc.stdout, proc) + fp = proc.stdout elif mode == 'w': proc = subprocess.Popen(cmd, bufsize=bufsize, shell=True, stdin=subprocess.PIPE) - return _wrap_close(proc.stdin, proc) + fp = proc.stdin + # files from subprocess are in binary mode but popen needs text mode + fp = fdopen(fp.fileno(), mode, bufsize) + return _wrap_close(fp, proc) # Helper for popen() -- a proxy for a file whose close waits for the process class _wrap_close(object): Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2010-04-02 16:15:48 UTC (rev 6998) +++ trunk/jython/NEWS 2010-04-04 00:16:58 UTC (rev 6999) @@ -21,6 +21,7 @@ - [ 1548 ] Parentheses in CLASSPATH cause errors in jython.bat - [ 1576 ] files opened in 'a+' mode not readable - [ 1563 ] unicode() for Java objects working differently in 2.2 and 2.5 + - [ 1566 ] os.popen(cmd).read() returns `\r\n` as newline on Windows with Jython 2.5 - Fix runtime issues during exitfuncs triggered via SystemRestart (such as during Django or Pylons development mode reloading) - Fix pickling of collections.defaultdict objects This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |