1

I'm using Shake to manage some scripts that might run a really long time (days or even weeks). They print their progress to stdout using the progressbar Python module. How can I make Shake echo that progress during the run, rather than just showing the "100%" state at the end?

Things I've tried:

  • changing shakeVerbosity and also set some other options like shakeCommandOptions = [EchoStdout True] and shakeLineBuffering = False

  • adding stdout.flush() calls to the scripts

UPDATE: If I just print to stdout rather than using the progress bar, that works. So maybe it has to do with line buffering? The progressbar probably doesn't print a newline until the end.

crockeea
  • 21,651
  • 10
  • 48
  • 101
jefdaj
  • 2,025
  • 2
  • 21
  • 33
  • It's almost certainly down to line buffering. Are you able to try out the HEAD version of Shake? I just pushed something I think might help. Note that if you are running long-running commands, and they output their progress to stderr (I rather suspect they will be), then make sure you set WithStderr False. – Neil Mitchell Jun 11 '16 at 18:59
  • It almost compiles but right at the end I get: In-place registering shake-0.15.8... Preprocessing executable 'shake' for shake-0.15.8... ghc: unrecognised flag: -qg did you mean one of: -g unrecognised flag: -qb Usage: For basic information, try the `--help' option. – jefdaj Jun 12 '16 at 01:17
  • It's also not that big a deal if I can't solve this, because I haven't tried doing it the "right way" yet with Shake's progress features. – jefdaj Jun 12 '16 at 03:30
  • Which `ghc --version` are you using? – Neil Mitchell Jun 12 '16 at 10:01
  • 7.10.3, but I'm on NixOS so I can try a different one if that helps. I think the newest is 8.0.1 as of a couple days ago – jefdaj Jun 12 '16 at 16:55
  • Both should work. I released a new version of Shake earlier today which should have the fix it in, so waiting for Nix to pick that up might be one option. – Neil Mitchell Jun 12 '16 at 20:06

1 Answers1

0

I believe this issue is fixed in the latest version of Shake, so should no longer occur (as of Jun 2016).

Neil Mitchell
  • 9,090
  • 1
  • 27
  • 85