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

Don't use enable-console-print in projects built with shadow #31

Open
borkdude opened this issue Jan 18, 2022 · 5 comments
Open

Don't use enable-console-print in projects built with shadow #31

borkdude opened this issue Jan 18, 2022 · 5 comments

Comments

@borkdude
Copy link
Contributor

(enable-console-print!)

See:
BetterThanTomorrow/calva#1468 (comment)

I still have to read the entire issue to find out why, when I have time.

@PEZ
Copy link

PEZ commented Jan 18, 2022

That comment is all there is to read about it on this issue (which is about other, also interesting things). In fact you don't even need to read the full comment. Only this part, from Thomas Heller:

Never call this with shadow-cljs anywhere. It is never required in any setup and it will interfere with printing.

@borkdude
Copy link
Contributor Author

Sure, but why? I'd like to understand the details. Is there a way to have the same code behave well in both shadow and cljs.main?

@PEZ
Copy link

PEZ commented Jan 18, 2022

I mainly wanted to hep you not have to read the whole issue. 😄 I don't know the details and haven't found any further info on this. Ping @thheller.

@borkdude
Copy link
Contributor Author

Fair enough :)

@thheller
Copy link

If you look at the implementation of enable-console-print! you'll see that it unconditionally sets *print-fn* and *print-err-fn*. shadow-cljs does set its own print-fn on load which will not only print to the console but also send all messages back to the shadow-cljs instances so it can send them futher along to the nrepl client or so.

As a safeguard I actually replace enable-console-print! with a noop. I actually forgot that I did that but I did it because too many people called this and wondered why they were getting no more prints in the REPL. ;)

In essence you can call it but you shouldn't.

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

No branches or pull requests

3 participants