Skip to content
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

Regression: no output during build step for Cabal scripts in 3.8 #8527

Open
georgefst opened this issue Oct 12, 2022 · 5 comments
Open

Regression: no output during build step for Cabal scripts in 3.8 #8527

georgefst opened this issue Oct 12, 2022 · 5 comments

Comments

@georgefst
Copy link

georgefst commented Oct 12, 2022

I don't see anything about this in the changelog.

Main.hs:

{- cabal:
build-depends: base
-}

module Main where

main = putStrLn "done"
$ cabal-3.6.2.0 run Main.hs
Resolving dependencies...
Build profile: -w ghc-9.2.3 -O1
In order, the following will be built (use -v for more details):
 - fake-package-0 (exe:script) (first run)
Configuring executable 'script' for fake-package-0..
Preprocessing executable 'script' for fake-package-0..
Building executable 'script' for fake-package-0..
[1 of 1] Compiling Main             ( Main.hs, /tmp/cabal-repl.-223388/dist-newstyle/build/x86_64-linux/ghc-9.2.3/fake-package-0/x/script/build/script/script-tmp/Main.o )
Linking /tmp/cabal-repl.-223388/dist-newstyle/build/x86_64-linux/ghc-9.2.3/fake-package-0/x/script/build/script/script ...
done
$ cabal-3.8.1.0 run Main.hs
done

This is great when nothing needs to be rebuilt (an impossible scenario before 3.8, as nothing was cached). And we do see some output if building fails. But I'd argue that it's very confusing not to see any during a successful build either. At least in the case where significant building of dependencies is necessary, it's impossible to know whether the script is hanging at run time, or useful work is being done.

It seems to me that the ideal behaviour would be for any output from the build step to go to stderr by default, perhaps with flags to alter behaviour.

@jneira
Copy link
Member

jneira commented Oct 12, 2022

hi, do you see the expected behaviour with -v or -v2?
I think the build output was removed by default as it interfered with the output of the script itself, making its use more difficult

@georgefst
Copy link
Author

Ah, thanks. -v1 is enough to see the output.

I'm not sure what the best UX is here. I feel like it would be less surprising if the build output were printed by default, with a message about how to disable it. But we'd want the ability to specify -v0 for Cabal from within the script, and AFAIK this isn't currently possible.

@georgefst
Copy link
Author

It seems to me that the ideal behaviour would be for any output from the build step to go to stderr by default, perhaps with flags to alter behaviour.

#7790 would be a big step in the right direction.

@ulysses4ever
Copy link
Collaborator

Just 2c: I think it's fine for cabal run to not print anything by default, and if you're interested in what happens at the build stage, you should rather use cabal build. Switching from stdout to stderr, albeit a noble goal, is neither close (for boring technical reasons, especially the test suite) nor strictly speaking related to this discussion whether we want any output at all.

@georgefst
Copy link
Author

I admittedly am not sure I'm familiar with your "boring technical reasons", but I think not printing anything would be (and in the case of scripts, is) pretty poor UX. A user wants to know what's going on when a process doesn't respond instantly.

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

No branches or pull requests

4 participants