Skip to content

CLIRepl is missing isatty() method #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ikanobori opened this issue Jul 4, 2014 · 6 comments
Closed

CLIRepl is missing isatty() method #149

ikanobori opened this issue Jul 4, 2014 · 6 comments
Labels

Comments

@ikanobori
Copy link
Contributor

Mercurial relies on the isatty() method on sys.stderr and sys.stdout for it's progress extension. Please add it to bpython.cli.CLIRepl

#!python
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "./inyoka/__init__.py", line 316, in <module>
    _bootstrap()
  File "./inyoka/__init__.py", line 301, in _bootstrap
    hgcmd.identify(ui, None, join(conts, '..'), num=True, id=True)
  File "/usr/lib/python2.6/site-packages/mercurial/commands.py", line 2118, in identify
    repo = hg.repository(ui, source)
  File "/usr/lib/python2.6/site-packages/mercurial/hg.py", line 94, in repository
    repo = _lookup(path).instance(ui, path, create)
  File "/usr/lib/python2.6/site-packages/mercurial/localrepo.py", line 1870, in instance
    return localrepository(ui, util.drop_scheme('file', path), create)
  File "/usr/lib/python2.6/site-packages/mercurial/localrepo.py", line 38, in __init__
    extensions.loadall(self.ui)
  File "/usr/lib/python2.6/site-packages/mercurial/extensions.py", line 94, in loadall
    uisetup(ui)
  File "/usr/lib/python2.6/site-packages/hgext/progress.py", line 197, in uisetup
    if shouldprint(ui) and not ui.debugflag and not ui.quiet:
  File "/usr/lib/python2.6/site-packages/hgext/progress.py", line 54, in shouldprint
    return sys.stderr.isatty() or ui.configbool('progress', 'assume-tty')
AttributeError: 'CLIRepl' object has no attribute 'isatty'

Thanks!


@ikanobori
Copy link
Contributor Author

Resolved since we do indeed have that object.


Original Comment By: Simon de Vlieger

@ikanobori
Copy link
Contributor Author

This should be closed, as we now have a FakeStdout object. (unless you mean it should work differently than stderr?)


Original Comment By:

@ikanobori
Copy link
Contributor Author

Added in <<changeset 32a235b4aa01>>. Leaving the issue open as we still need a FakeStdout object.


Original Comment By: Andreas Stührk

@ikanobori
Copy link
Contributor Author

I was always in favour of a FakeStdout object instead of randomly adding things to the repl object where they don't belong to at all.


Original Comment By: Andreas Stührk

@ikanobori
Copy link
Contributor Author

If you do that, then it would be better to abstract a FakeStdout too, sys.stdout.isatty is also used in mercurial (and other apps)


Original Comment By: Christopher Grebs

@ikanobori
Copy link
Contributor Author

I have previously added a isatty method to our FakeStdin object. Andreas, what do you think of adding it to CLIRepl too? Maybe we should abstract out a FakeStderr as well?


Original Comment By: Simon de Vlieger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant