From: <pj...@us...> - 2007-09-24 05:58:58
|
Revision: 3524 http://jython.svn.sourceforge.net/jython/?rev=3524&view=rev Author: pjenvey Date: 2007-09-23 22:58:54 -0700 (Sun, 23 Sep 2007) Log Message: ----------- fix javashell not handling unicode commands correctly, with tests fixes bug #1735774 thanks Pekka Laukkanen Modified Paths: -------------- trunk/jython/Lib/javashell.py trunk/jython/Lib/test/test_javashell.py trunk/jython/NEWS Modified: trunk/jython/Lib/javashell.py =================================================================== --- trunk/jython/Lib/javashell.py 2007-09-24 01:33:00 UTC (rev 3523) +++ trunk/jython/Lib/javashell.py 2007-09-24 05:58:54 UTC (rev 3524) @@ -75,7 +75,7 @@ " setting %s. Failed command=%s""" raise OSError( 0, msgFmt % ( _osType, _envType, cmd )) - if isinstance(cmd, types.StringType): + if isinstance(cmd, basestring): shellCmd = self.cmd + [cmd] else: shellCmd = cmd Modified: trunk/jython/Lib/test/test_javashell.py =================================================================== --- trunk/jython/Lib/test/test_javashell.py 2007-09-24 01:33:00 UTC (rev 3523) +++ trunk/jython/Lib/test/test_javashell.py 2007-09-24 05:58:54 UTC (rev 3524) @@ -163,6 +163,17 @@ newValue, value )) + def testFormatUnicodeCommand(self): + shell = javashell._ShellEnv(cmd=['runner']) + self.assertEqual(shell._formatCmd('echo hello'), ['runner', 'echo hello']) + self.assertEqual(shell._formatCmd(u'echo world'), ['runner', u'echo world']) + + def testExecuteUnicodeCommandWithRedirection(self): + process = javashell.shellexecute(u'nonexcmd 2>&1') + stdout = process.getOutputStream().toString() + process.waitFor() + self.assertNotEqual(stdout, "", "Redirecting 2>&1 failed with unicode cmd") + def test_main(): test_support.run_unittest(JavaShellTest) Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2007-09-24 01:33:00 UTC (rev 3523) +++ trunk/jython/NEWS 2007-09-24 05:58:54 UTC (rev 3524) @@ -14,6 +14,7 @@ - [ 1799328 ] string formatting doesn't call __unicode__ on %s in unicode objects - [ 1763263 ] os.utime(path, None) doesn't work (incl. a patch) - [ 1758904 ] I added doc strings for functions in os module (javaos.py). + - [ 1735774 ] Redirecting stdout/err with os.popen fails if cmd is unicode Jython 2.2 No changes from 2.2 rc3 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |