Quick fix for os.system requiring str parameter #1005

Merged
merged 3 commits into from Nov 17, 2011
@@ -2082,8 +2082,10 @@ def system_raw(self, cmd):
with AvoidUNCPath() as path:
if path is not None:
cmd = '"pushd %s &&"%s' % (path, cmd)
+ cmd = py3compat.unicode_to_str(cmd)
ec = os.system(cmd)
else:
+ cmd = py3compat.unicode_to_str(cmd)
ec = os.system(cmd)
# We explicitly do NOT return the subprocess status code, because
@@ -220,3 +220,11 @@ def test_1(self):
"""Test safe_execfile with non-ascii path
"""
_ip.shell.safe_execfile(self.fname, {}, raise_exceptions=True)
+
+
+class TestSystemRaw(unittest.TestCase):
+ def test_1(self):
+ """Test system_raw with non-ascii cmd
+ """
+ cmd = ur'''python -c "u'åäö'" '''
+ _ip.shell.system_raw(cmd)