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
--no-color flag doesn't suppress color output #4292
Comments
The |
@bew ok, that's not really intuitive at the first glance but makes sense: $ crystal eval
puts a
Error in line 1: undefined local variable or method 'a' (did you mean 'p'?) # => colorized
$ crystal eval --no-color
puts a
Error in line 1: undefined local variable or method 'a' (did you mean 'p'?) # => not colorized What about spec output (case 3) ? #1587 |
About the spec output, the mentioned patch seems to be gone now.. Maybe we could add an ENV variable |
something like this for example: diff --git a/src/compiler/crystal/command/spec.cr b/src/compiler/crystal/command/spec.cr
index 49f1803df..b87849d4c 100644
--- a/src/compiler/crystal/command/spec.cr
+++ b/src/compiler/crystal/command/spec.cr
@@ -60,6 +60,10 @@ class Crystal::Command
end
end
+ if @color
+ compiler.flags << "SPEC_NO_COLOR"
+ end
+
source_filename = File.expand_path("spec")
source = target_filenames.map { |filename| %(require "./#{filename}") }.join("\n")
diff --git a/src/spec.cr b/src/spec.cr
index cbc605a6c..d08539686 100644
--- a/src/spec.cr
+++ b/src/spec.cr
@@ -113,6 +113,10 @@ if ENV["SPEC_VERBOSE"]? == "1"
Spec.override_default_formatter(Spec::VerboseFormatter.new)
end
+{% if flag?("SPEC_NO_COLOR") %}
+ Spec.use_colors = false
+{% end %}
+
Signal::INT.trap { Spec.abort! }
Spec.run |
Couldn't the |
You can pass The option is not accepted or passed by to the child program by
And even so contains colored elements: Versus full colored one: |
Spec runner have the option to disable colored output (ANSI codes) when `--no-color` option is used, example: $ crystal spec -- --no-color However, certain elements in the output didn't fully support that option, resulting in a mix of non-color and color. This change unifies that setting and ensures that `--no-color` usage is fully honored by the output. Ref #4292
Thx @luislavena |
I tried 3 cases:
I expect the output colors to be suppressed in each of those cases.
Crystal 0.21.1+70 [7ca33b9] (2017-04-14) LLVM 4.0.0 on OS X 10.12
The text was updated successfully, but these errors were encountered: