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

"zig run" pollutes debug output with unexpected messages "LLVM Emit Object... LLVM Emit Object... MachO Flush..." #19647

Closed
obask opened this issue Apr 14, 2024 · 7 comments
Labels
bug Observed behavior contradicts documented or intended behavior
Milestone

Comments

@obask
Copy link

obask commented Apr 14, 2024

Zig Version

0.12.0-dev.3644+05d975576

Steps to Reproduce and Observed Behavior

invoke "zig run" on any source file

Expected Behavior

According to "No hidden control flow" principle, it shouldn't output anything which is not a part of a program defined by user. Current approach is very confusing because it hides a first line of the debug output making it looks like the program had no output while it's simply hidden behind "LLVM Emit Object... LLVM Emit Object... MachO Flush..." string and forcing addition of std.debug.print("\n", .{}); to every program.

Screenshot 2024-04-13 at 7 45 24 PM

@obask obask added the bug Observed behavior contradicts documented or intended behavior label Apr 14, 2024
@RossComputerGuy
Copy link
Contributor

I don't really see this as a bug. Maybe there should be a way to hide or enable the message. However, zig does display this whenever you also do zig build --help which you could argue that it is also "hidden control flow". In reality, it kinda isn't "hidden control flow" as Zig has to emit an object to execute it. As you told Zig to run a file, it has to compile it first.

@nektro
Copy link
Contributor

nektro commented Apr 14, 2024

Zig deletes these strings using standard ansi escape sequences before launching the compiled executable, and it is this runner view not supporting them.

Additionally, you can zig build-exe file.zig and ./file separately if you would like to only get the output of the program.

@obask
Copy link
Author

obask commented Apr 14, 2024

Thanks! I agree this could have been labeled a feature request, but unfortunately, I can't change the label now. It would be great if verbose mode were only activated with the -v option. I understand the initial reason might have been to show that the program is active and not stuck during long compilation, but perhaps this will become unnecessary with an incremental compiler. It's your call, of course; I'm just pointing out aspects that might be confusing to an outsider like myself.

@mikastiv
Copy link

mikastiv commented Apr 15, 2024

Maybe related to #18855

@obask
Copy link
Author

obask commented Apr 16, 2024

related to #18855

It seems that zig build run is more useful compared to zig run, because the latter doesn't understand external dependencies. I'm not sure about its future in more complex projects; perhaps it will be deprecated or reserved for simple shell-like scripts.

@VisenDev
Copy link

Possibly related concerns #17821

@andrewrk andrewrk added this to the 0.13.0 milestone May 31, 2024
@andrewrk
Copy link
Member

Fixed by #20059

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

6 participants