sandwich icon indicating copy to clipboard operation
sandwich copied to clipboard

FAQ/Common issues

Open PPKFS opened this issue 3 years ago • 2 comments

This is mostly a case of me spending 3 hours trying to work out why some things weren't working, and diving into brick and vty to no avail and discovering that the problem was silly little things on my end -- but I couldn't find any mention of them online anywhere. I wonder if they are worth documenting somewhere to ensure nobody does the same things as me, but gives up trying to get sandwich working.

Namely:

  • cabal test --test-options=--tui does now work, but it will cut off the tui at 80 columns.
  • when using terminalUICustomExceptionFormatters, it will be ignored if you use runSandwichWithCommandLineArgs and --tui.

PPKFS avatar Jul 16 '22 11:07 PPKFS

Sorry to hear about that, definitely open to improving the documentation!

cabal test --test-options=--tui does now work, but it will cut off the tui at 80 columns.

FWIW, whenever I work with the TUI I do it by running the actual executable. I.e. using stack run instead of stack test, since the latter doesn't allocate a TTY. Not sure off the top of my head how that translates to cabal. I'm a little surprised you got it to work with cabal test. Agreed this should be very prominent in the documentation. At some point I'd like to open PRs against stack and cabal so that stack/cabal test can start up a TUI app seamlessly.

when using terminalUICustomExceptionFormatters, it will be ignored if you use runSandwichWithCommandLineArgs and --tui.

Ah, that would be a bug. We should forward any terminalUICustomExceptionFormatters in that case. Just opened #61.

thomasjm avatar Jul 16 '22 12:07 thomasjm

I remembered seeing the issues about it not working through stack/cabal so I too was quite surprised when it 'worked' with cabal test. I'm guessing cabal has some virtual terminal, but it truncates it to 80 columns wide. cabal run foo-test works flawlessly though!

PPKFS avatar Jul 16 '22 12:07 PPKFS

The TUI works with stack test now as of 2.9.3.

Things work with Cabal if you invoke the tests using cabal run, or if you set test-show-details: direct. (The latter should become the default in an upcoming version of Cabal; see https://github.com/haskell/cabal/issues/7817). Some more discussion around that is here: https://github.com/haskell/cabal/pull/8604.

The terminalUICustomExceptionFormatters issue is tracked in #61 so I think this issue can be closed!

thomasjm avatar Jan 25 '23 19:01 thomasjm