batterseapower / test-framework

Framework for running and organising QuickCheck test properties and HUnit test cases
http://bsp.lighthouseapp.com/projects/15661-hs-test-framework
83 stars 45 forks source link

Pretty console output doesn't restore terminal cursor (Lighthouse #3) #46

Open fatuhoku opened 11 years ago

fatuhoku commented 11 years ago

Originally reported by Edward Z. Yang | August 26th, 2010 @ 06:31 PM

Run a test-framework driver.

Expected: When it's done, my terminal cursor is restored Actual: Terminal cursor not restored.

This might be ansi-terminal/ansi-wl-pprint's fault, or we might not be calling the correct reset frob.

fatuhoku commented 11 years ago

Edward Z. Yang replies on August 26th, 2010 @ 10:34 PM

Extra information: this only seems to occur when using runghc, not when running a compiled binary.

fatuhoku commented 11 years ago

Edward Z. Yang replies on August 26th, 2010 @ 10:45 PM

Fix is to explicitly flush after you restore the cursor:

hideCursorDuring :: IO a -> IO a
hideCursorDuring action = bracket hideCursor (const (showCursor >> hFlush stdout)) (const action)
fatuhoku commented 11 years ago

Edward Z. Yang replies on August 26th, 2010 @ 10:48 PM

See also here; it looks like this got fixed in GHC 6.12.3.