diff options
author | Ben Sima <ben@bsima.me> | 2023-08-16 13:45:40 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2023-08-16 18:24:05 -0400 |
commit | 30d03210f7ac5b12235760f625bac5ff3aa3f85a (patch) | |
tree | 09cc458e1e4e884d126b21ee03a7a95a7ae3451f /Biz/Bild.nix | |
parent | 5c214478cc2d9e78ba78f3911f9fede2029c829f (diff) |
Log and return output to caller
The main change here is 'puts' now returns a value, this enables me to
collect the value from the conduit source while also doing stuff with
it, like printing or logging it as I want.
Previously I was running conduit over the source, *and then* kicking off
the concurrent processes to wait for the process and collect the output.
This would (I think) drain the source before it got to the 'puts'
conduit run, and so I wouldn't be able to get the output streamed in
real time.
It took a lot of refactoring and exploratory programming to get to this
relatively-small diff, but now puts works correctly. At least I think it
does... it seems to work more reliably from ghci than from the shell.
Maybe the shell or TERM is causing nix-store to do some buffering? Maybe
I need to use the threaded runtime in GHC? Not sure, but I will look out
for this issue and try to identify and fix.
Update: yep it was the threaded runtime. I enabled that and now it works
in the shell. I squashed that commit into this one.
Diffstat (limited to 'Biz/Bild.nix')
-rw-r--r-- | Biz/Bild.nix | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Biz/Bild.nix b/Biz/Bild.nix index 0391d84..dca1b3b 100644 --- a/Biz/Bild.nix +++ b/Biz/Bild.nix @@ -32,7 +32,7 @@ rec { ghcPackageSetBild = private.ghcWith (hpkgs: with hpkgs; [ aeson async base bytestring conduit conduit-extra containers directory docopt filepath process protolude rainbow regex-applicative split tasty - tasty-hunit tasty-quickcheck text neat-interpolation + tasty-hunit tasty-quickcheck text hostname wai # can remove when removed from Biz.Log ]); @@ -50,14 +50,13 @@ rec { # this is just to get access to ghc-pkg in bild (private.ghcWith (hpkgs: with hpkgs; [])) - /* disable until nixified builds are complete + /* disable until nixified builds are complete */ rustc # c deps gcc gdb valgrind argp-standalone SDL # lisp deps guile (private.sbclWith (p: with p; [asdf alexandria])) # just enough to build Example.lisp - */ ]; # a standard nix build for `bild` - this should be the only hand-written @@ -75,6 +74,7 @@ rec { ${private.ghcPackageSetFull}/lib/ghc-${private.ghcPackageSetFull.version}/package.conf.d \ $out/lib/ghc-${private.ghcPackageSetFull.version} ghc \ + -threaded \ -Werror \ -i. \ --make Biz/Bild.hs \ |