diff --git a/src/mog_commons/__init__.py b/src/mog_commons/__init__.py index 850505a..13b7089 100644 --- a/src/mog_commons/__init__.py +++ b/src/mog_commons/__init__.py @@ -1 +1 @@ -__version__ = '0.1.10' +__version__ = '0.1.11' diff --git a/src/mog_commons/command.py b/src/mog_commons/command.py index b97f778..a073ba2 100644 --- a/src/mog_commons/command.py +++ b/src/mog_commons/command.py @@ -22,7 +22,7 @@ def __convert_args(args, shell, cmd_encoding): if workaround: return ['/bin/sh', '-c', s], False else: - return args, shell + return s, shell # input as list xs = ['/bin/sh', '-c'] if workaround else [] diff --git a/tests/mog_commons/test_command.py b/tests/mog_commons/test_command.py index 293d5da..aba7cbe 100644 --- a/tests/mog_commons/test_command.py +++ b/tests/mog_commons/test_command.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import division, print_function, absolute_import, unicode_literals +import os import time import threading from mog_commons.command import * @@ -13,6 +14,10 @@ def test_execute_command(self): self.assertEqual(execute_command('exit 3', shell=True), 3) self.assertEqual(execute_command(['/bin/sh', '-c', 'exit 4'], shell=False), 4) + with self.withAssertOutputFile(os.path.join('tests', 'resources', 'sjis_ja.txt'), + expect_file_encoding='sjis', output_encoding='sjis') as out: + execute_command('echo "あいうえお"', shell=True, cmd_encoding='sjis', stdout=out) + def test_capture_command(self): self.assertEqual(capture_command(['echo', 'あいう'], shell=True), (0, 'あいう\n'.encode('utf-8'), b'')) diff --git a/tests/resources/sjis_ja.txt b/tests/resources/sjis_ja.txt new file mode 100644 index 0000000..da4508a --- /dev/null +++ b/tests/resources/sjis_ja.txt @@ -0,0 +1 @@ +