aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-10-17 21:46:41 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-10-17 21:55:49 -0400
commit2d5b2bf1c986d037ef965bf8c9b4d8dfd5967478 (patch)
treee7b0f9f6f509e34edeb2226569b2ae78d34cfb5a /src/main.cpp
parent299991019dddb2acd076d4b2698a4fd6a7a6ae94 (diff)
downloadzig-2d5b2bf1c986d037ef965bf8c9b4d8dfd5967478.tar.gz
zig-2d5b2bf1c986d037ef965bf8c9b4d8dfd5967478.zip
improve progress reporting
* use erase rest of line escape code. * use `stderr.supportsAnsiEscapeCodes` rather than `isTty`. * respect `--color off` * avoid unnecessary recursion * add `Progress.log` * disable the progress std lib test since it's noisy and uses `time.sleep()`. * enable/integrate progress printing with the default test runner
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 13c93b269d..b398eec991 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -506,8 +506,6 @@ int main(int argc, char **argv) {
ZigList<const char *> llvm_argv = {0};
llvm_argv.append("zig (LLVM option parsing)");
- Stage2ProgressNode *root_progress_node = stage2_progress_start_root(stage2_progress_create(), "", 0, 0);
-
if (argc >= 2 && strcmp(argv[1], "build") == 0) {
Buf zig_exe_path_buf = BUF_INIT;
if ((err = os_self_exe_path(&zig_exe_path_buf))) {
@@ -589,6 +587,7 @@ int main(int argc, char **argv) {
Buf *cache_dir_buf = buf_create_from_str(cache_dir);
full_cache_dir = os_path_resolve(&cache_dir_buf, 1);
}
+ Stage2ProgressNode *root_progress_node = stage2_progress_start_root(stage2_progress_create(), "", 0, 0);
CodeGen *g = codegen_create(main_pkg_path, build_runner_path, &target, OutTypeExe,
BuildModeDebug, override_lib_dir, nullptr, &full_cache_dir, false, root_progress_node);
@@ -965,6 +964,10 @@ int main(int argc, char **argv) {
return EXIT_FAILURE;
}
+ Stage2Progress *progress = stage2_progress_create();
+ Stage2ProgressNode *root_progress_node = stage2_progress_start_root(progress, "", 0, 0);
+ if (color == ErrColorOff) stage2_progress_disable_tty(progress);
+
init_all_targets();
ZigTarget target;