Skip to content

Commit

Permalink
Allow output redirection on Windows.
Browse files Browse the repository at this point in the history
Closes #88.
  • Loading branch information
jkbrzt committed Sep 21, 2012
1 parent 4a6f32a commit a41dd7a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
1 change: 1 addition & 0 deletions README.rst
Expand Up @@ -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``.
Expand Down
6 changes: 1 addition & 5 deletions httpie/input.py
Expand Up @@ -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':
Expand Down Expand Up @@ -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]

Expand Down
13 changes: 1 addition & 12 deletions tests/tests.py
Expand Up @@ -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(
Expand All @@ -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):
Expand Down

0 comments on commit a41dd7a

Please sign in to comment.