From a41dd7ac6d42dcd1cfdaf2f9f60a76c38eafd7c3 Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Fri, 21 Sep 2012 04:30:59 +0200 Subject: [PATCH] Allow output redirection on Windows. Closes #88. --- README.rst | 1 + httpie/input.py | 6 +----- tests/tests.py | 13 +------------ 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/README.rst b/README.rst index d4fb3f9842..1fe59f6f59 100644 --- a/README.rst +++ b/README.rst @@ -1026,6 +1026,7 @@ Changelog *You can click a version name to see a diff with the previous one.* * `0.2.8-alpha`_ + * Allow output redirection on Windows. * Added config file. * Added persistent session support. * Renamed ``--allow-redirects`` to ``--follow``. diff --git a/httpie/input.py b/httpie/input.py index 3300a42cb0..5b30b08996 100644 --- a/httpie/input.py +++ b/httpie/input.py @@ -96,10 +96,6 @@ def parse_args(self, env, args=None, namespace=None): self.env = env - if env.is_windows and not env.stdout_isatty: - self.error('Output redirection is not supported on Windows.' - ' Please use `--output FILE\' instead.') - args = super(Parser, self).parse_args(args, namespace) if not args.json and env.config.implicit_content_type == 'form': @@ -244,7 +240,7 @@ def _process_pretty_options(self, args, env): if args.prettify == PRETTY_STDOUT_TTY_ONLY: args.prettify = PRETTY_MAP['all' if env.stdout_isatty else 'none'] elif args.prettify and env.is_windows: - self.error('Only terminal output can be prettified on Windows.') + self.error('Only terminal output can be colorized on Windows.') else: args.prettify = PRETTY_MAP[args.prettify] diff --git a/tests/tests.py b/tests/tests.py index 02e8b52b96..c5c8f12ce0 100755 --- a/tests/tests.py +++ b/tests/tests.py @@ -941,17 +941,6 @@ def test_windows_colorized_output(self): class FakeWindowsTest(BaseTestCase): - def test_stdout_redirect_not_supported_on_windows(self): - env = TestEnvironment(is_windows=True, stdout_isatty=False) - r = http( - 'GET', - httpbin('/get'), - env=env - ) - self.assertNotEqual(r.exit_status, EXIT.OK) - self.assertIn('Windows', r.stderr) - self.assertIn('--output', r.stderr) - def test_output_file_pretty_not_allowed_on_windows(self): r = http( @@ -963,7 +952,7 @@ def test_output_file_pretty_not_allowed_on_windows(self): env=TestEnvironment(is_windows=True) ) self.assertIn( - 'Only terminal output can be prettified on Windows', r.stderr) + 'Only terminal output can be colorized on Windows', r.stderr) class StreamTest(BaseTestCase):