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

missing newline at the end of "Progress: 1/2" #1302

Open
FranklinYu opened this Issue Nov 7, 2015 · 12 comments

Comments

Projects
None yet
4 participants
@FranklinYu

FranklinYu commented Nov 7, 2015

When I run stack test the newline is missing, so this line and next (testing message in my case) are concatenated into one. I found the source at Execute.hs but I have no idea how to fix it since I am a Haskell newbie. Minor bug, but should be easy to fix (I assume).

@rubik

This comment has been minimized.

Contributor

rubik commented Nov 7, 2015

I noticed this bug as well. It would suffice to add <> "\n" at the end, but I find it very strange that logSticky does not append newlines automatically. In fact, searching for occurrences of logSticky in Stack's source shows that it's never used with newlines:
https://github.com/commercialhaskell/stack/search?utf8=%E2%9C%93&q=logsticky

So the problem must be somewhere else.

@FranklinYu

This comment has been minimized.

FranklinYu commented Nov 11, 2015

@rubik I read the description of logSticky; it says that we need logStickyDone if we need the trailing newline. Actually I should not have seen the "Progress: 1/2" in the final output; output after logStickyDone should have overwritten this line, and this happens (as expected) if nothing is printed during test, i.e.,

main :: IO ()
main = return ()

So basically any output in test suite, even as simple as

main :: IO ()
main = putStrLn "test"

will break the logSticky and leave the "Progress 1/2" in final output.

@FranklinYu

This comment has been minimized.

FranklinYu commented Nov 11, 2015

One of the template, new-template, serves as an example of this bug.

@rubik

This comment has been minimized.

Contributor

rubik commented Nov 11, 2015

Well done @FranklinYu, I can confirm what you said. My test suite uses Hspec and Stack's output is hijacked because of this. One possible solution could be to suspend the progress status during tests and resume it right after. This is not very easy to do because the function executePlan' is used for many things, not only tests.

@borsboom

This comment has been minimized.

Contributor

borsboom commented Nov 17, 2015

I think Stack should be capturing the output of the tests (and benchmarks, which I suspect will have the same problem) and re-emitting it in a way that's friendly to the sticky progress, the same way as it does for GHC output.

@FranklinYu

This comment has been minimized.

FranklinYu commented Nov 19, 2015

@borsboom Yes I think that is a better solution!

@mgsloan mgsloan referenced this issue Nov 30, 2015

Merged

Support for detailed-0.9 test type #1447

5 of 5 tasks complete

mgsloan added a commit that referenced this issue Dec 12, 2015

mgsloan added a commit that referenced this issue Dec 12, 2015

Clear progress msg before running test #1302
+ add a trailing newline to test output
@mgsloan

This comment has been minimized.

Collaborator

mgsloan commented Dec 12, 2015

There were two issues here:

  • runActions wasn't waiting for the progress thread to finish its work before exiting, so we wouldn't always get the $logStickyDone message that actions completed.
  • Test output is being directly sent to stack's stdout / stderr, without first clearing the sticky message. It now clears the sticky message before running the test.

Please reopen if not resolved in the development version.

@mgsloan mgsloan closed this Dec 12, 2015

mgsloan added a commit that referenced this issue Dec 14, 2015

@borsboom

This comment has been minimized.

Contributor

borsboom commented Dec 24, 2015

I'm reopening this since the fix was reverted.

@borsboom borsboom reopened this Dec 24, 2015

@mgsloan

This comment has been minimized.

Collaborator

mgsloan commented Dec 26, 2015

Good catch! I thought 68ef027 was sufficient, but turns out that you still get the "Progress 1/2" message. Weird!

mgsloan added a commit that referenced this issue Jan 10, 2016

@mgsloan

This comment has been minimized.

Collaborator

mgsloan commented Jan 10, 2016

Fixed!

@mgsloan mgsloan closed this Jan 10, 2016

@mgsloan

This comment has been minimized.

Collaborator

mgsloan commented Jan 21, 2016

Darn, the resolution to #1685 brought this back

@mgsloan mgsloan reopened this Jan 21, 2016

@mgsloan

This comment has been minimized.

Collaborator

mgsloan commented Jun 17, 2016

I don't have time to work on this right now, but I have a theory it may be due to hPutStrLn h t = hPutStr h t >> hPutChar h '\n' in Data.Text. Concurrent execution can cause other output to be inserted between your text and the newline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment