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

Avoid an error when Base.have_color === nothing #23

Merged
merged 1 commit into from
Apr 22, 2022

Conversation

tkf
Copy link
Contributor

@tkf tkf commented Apr 22, 2022

Since Base.have_color can be nothing,

push!(cmd.exec, "--color=$(Base.have_color ? "yes" : "no")")

fails with

$ jlpkg --julia=julia1.7 --version
ERROR: LoadError: TypeError: non-boolean (Nothing) used in boolean context
Stacktrace:
 [1] top-level scope
   @ ~/.julia/bin/jlpkg:26
in expression starting at /home/arakaki/.julia/bin/jlpkg:16

if --color is not given or --color=auto is used:

$ julia -E 'Base.have_color'
nothing
$ julia --color=auto -E 'Base.have_color'
nothing
$ julia --color=yes -E 'Base.have_color'
true
$ julia --color=no -E 'Base.have_color'
false

Since the color flag is handled by julia itself for Julia 1.6 and later as of jlpkg 1.5.0 fb884b6#diff-d2e1242ec6c61066777ffb9c3e75722fbbd5d86b75ce53366a648d9068104a17R11 maybe it is better to remove this manual propagation?

@fredrikekre
Copy link
Owner

fredrikekre commented Apr 22, 2022

maybe it is better to remove this manual propagation

Yea, that's fine. Edit: Oh, that is what the patch is already doing.

@codecov-commenter
Copy link

codecov-commenter commented Apr 22, 2022

Codecov Report

Merging #23 (03e0cb8) into master (3726a5e) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master      #23   +/-   ##
=======================================
  Coverage   98.03%   98.03%           
=======================================
  Files           2        2           
  Lines          51       51           
=======================================
  Hits           50       50           
  Misses          1        1           
Impacted Files Coverage Δ
src/cli.jl 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3726a5e...03e0cb8. Read the comment docs.

@fredrikekre fredrikekre merged commit 145ad3a into fredrikekre:master Apr 22, 2022
@tkf tkf deleted the nothing-have_color branch April 22, 2022 13:19
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

Successfully merging this pull request may close these issues.

None yet

3 participants