Julia: got error on the Base.run_main_repl when have_color is nothing

Created on 15 Jun 2020  Â·  6Comments  Â·  Source: JuliaLang/julia

hello. when I trying this

$ julia --color=auto -e "Base.run_main_repl(true, true, false, true, false)"
julia>
$ julia --color=auto -e "Base.run_main_repl(true, true, false, true, true)"
ERROR: MethodError: no method matching REPL.LineEditREPL(::REPL.Terminals.TTYTerminal, ::Nothing, ::Bool)
Closest candidates are:
  REPL.LineEditREPL(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any) at /Users/wookyoung/head/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:450
  REPL.LineEditREPL(::REPL.Terminals.TextTerminal, ::Bool, ::Bool) at /Users/wookyoung/head/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:460
  REPL.LineEditREPL(::REPL.Terminals.TextTerminal, ::Bool) at /Users/wookyoung/head/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:460
Stacktrace:
 [1] (::Base.var"#833#835"{Bool,Bool,Bool,Bool})(::Module) at ./client.jl:380
 [2] #invokelatest#1 at ./essentials.jl:710 [inlined]
 [3] invokelatest at ./essentials.jl:709 [inlined]
 [4] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:371
 [5] top-level scope at none:1

This is probably a missed bug that since the PR : Enable color output whenever stdout is TTY #34347 has introduced the global variable have_color as being [nothing].(https://github.com/JuliaLang/julia/pull/34347/files#diff-8d2b8a22d475d81e3a1944aedb57ad42R6)

At the function run_main_repl in base/client.jl

function run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_file::Bool, color_set::Bool)
# ...
                active_repl = REPL.LineEditREPL(term, have_color, true)

I think that the above line should be changed to something like:

                 active_repl = REPL.LineEditREPL(term, have_color === true, true)
julia> versioninfo()
Julia Version 1.6.0-DEV.229
Commit a66ee3f28a* (2020-06-15 19:40 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.5.0)
  CPU: Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
Environment:
  JULIA_CUDA_SILENT = 1

thanks.

All 6 comments

I am not able to reproduce it. It works fine for me on Windows and Linux.

Thanks I was able to reproduce it and I fix it. Should I send a PR for this?

@mgautam98 Sure, you could.

What is the use case for calling run_main_repl? It's an internal function. The last argument, color_set, means that a color setting has been specified, so passing true when that isn't the case is inconsistent, so I'm not sure there's anything to do here.

oh, if so, it's not a bug.
closing the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ararslan picture ararslan  Â·  3Comments

yurivish picture yurivish  Â·  3Comments

StefanKarpinski picture StefanKarpinski  Â·  3Comments

dpsanders picture dpsanders  Â·  3Comments

i-apellaniz picture i-apellaniz  Â·  3Comments