Giter VIP home page Giter VIP logo

Comments (4)

timsneath avatar timsneath commented on July 1, 2024

Thanks! Fixed by exclusion. Finding cursor position requires writing an ANSI character code to stdout and then reading the response to stdin, so if the latter isn't available, the call will fail. That seems to be a limitation of GitHub Actions, so I've edited the tests to require a working stdin/stdout. Was there something else you were looking at other than the tests?

from dart_console.

bsutton avatar bsutton commented on July 1, 2024

This is a broader problem than just the unit tests.
I'm using the cursor position in production code.
In some instances the production code runs without a head (e.g. docker).
I would be nice if the code behaved in a more consistent manner when running headless.

I'm a little unsure just what the correct action is.
I think there are two components.

  1. discoverability
    How can a user check/know that the function will work.
  2. what should the function do if called without the pre-conditions being met.

There is probably a reasonable argument that this can be done by documenting the limitations on the method call and then throwing an appropriate exception such as:

throw IllegalState('cursor position not supported when not attached to a console');

Perhaps also a method such as 'isAttached' so that the user can easily discover the state without having to work out stdin and stdout.

from dart_console.

timsneath avatar timsneath commented on July 1, 2024

Yeah, there's certainly the opportunity to detect whether the console is running headless or not. I'm wondering how other tools do it.

Help me understand the scenario: is it something like a progress bar, where you want to keep rewriting the same line? Looking at our own tools (e.g. dart test), I see we just spew out multiple lines in that scenario. There may be a variant of the method that resets to the home column even if it's not a terminal that supports ANSI escape codes.

from dart_console.

bsutton avatar bsutton commented on July 1, 2024

from dart_console.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.