Skip to content
Myr

Merge pull request #1591 from andy-maier/andy/fix-unsupportedoperation

Before adoption: this commit came in with the history the project adopted, so no landing records it.

tolerate UnsupportedOperation in _winconsole._is_console()

authored by David Lord · committed by GitHub · parents dfb842d, ce23ce8 · Browse files · 3 files+9 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+9 added−1 removed

  • tests:+6 added−0 removed
  • other:+3 added−1 removed

3 files+9 added−1 removed

modified:src/click/_winconsole.py+1 added-1 removed
282 unmodified lines
283 return False284285 try:286 fileno = f.fileno()287 except OSError:287 except (OSError, io.UnsupportedOperation):288 return False289290 handle = msvcrt.get_osfhandle(fileno)291 return bool(GetConsoleMode(handle, byref(DWORD())))
17 unmodified lines
modified:tests/test_utils.py+6 added
259 unmodified lines
260 assert out == ""261 assert err == "Pause to stderr\n"262263264def test_echo_with_capsys(capsys):265 click.echo("Capture me.")266 out, err = capsys.readouterr()267 assert out == "Capture me.\n"268269270def test_open_file(runner):271 @click.command()272 @click.argument("filename")273 def cli(filename):
111 unmodified lines
modified:CHANGES.rst+2 added
20 unmodified lines
21- An ``IntRange`` option shows the accepted range in its help text.22 :issue:`1525`23- An option defined with duplicate flag names (``"--foo/--foo"``)24 raises a ``ValueError``. :issue:`1465`25- ``echo()`` will not fail when using pytest's ``capsys`` fixture on26 Windows. :issue:`1590`272829Version 7.1.230-------------
635 unmodified lines