Skip to content
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

fix: cursor and newline missing when running without --watch #49

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bartekpacia
Copy link

Fixes #46

Changes proposed

Apparently the finally block containing VT100.showCursor and VT100.newline was not executed because the function was being returned from within the try block.

Now it's fixed. I didn't write tests for it because I'm not familiar with this project's codebase at all.

Check List (Check all the applicable boxes)

  • My code follows the code style of this project.
  • This PR does not contain plagiarized content.
  • The title and description of the PR is clear and explains the approach.

return sub.read()
..then((_) => stdout
..write(VT100.showCursor)
..write('\n'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the extra \n?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise this problem occurs.

@@ -231,7 +231,12 @@ Future<int> spec({
final sub = ref.listen($exitCode.future, (previous, current) {});

// Outside of watch mode, quit as soon we know what the exit code should be
return sub.read();
return () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function block is unnecessary. You don't have to put everything on the return keyword

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rewrote it a bit.

@rrousselGit
Copy link
Contributor

Thanks!

@rrousselGit rrousselGit changed the title fix cursor and newline missing when running without --watch fix: cursor and newline missing when running without --watch Feb 8, 2023
@rrousselGit
Copy link
Contributor

Do you mind writing a test for this?

As an example, you can look at summary contains list of all errors independently from suites/groups within spec_cli_test.dart. This should give you enough clues for what to do.

You might have to change TestRenderer (cf the testRenderer variable`) to optionally disable the ANSI removal from the output (line 88 in test/utils.dart)

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

Successfully merging this pull request may close these issues.

Cursor disappears after running spec
2 participants