bhauman / rebel-readline

Terminal readline library for Clojure dialects
Eclipse Public License 1.0
684 stars 37 forks source link

[Windows Terminal/PowerShell compatibility] Unable to detect a system Terminal, you must not launch the Rebel readline\nfrom an intermediate process.\nIf you are using `lein` you may need to use `lein trampoline`. #216

Closed yesudeep closed 1 year ago

yesudeep commented 1 year ago

Hello,

When running a repl using Bazel using some custom rules, I get this error. How would one go about addressing this problem?

rules_clojure on  main took 2s
❯ bazel run //tests/hello_world:hello_world_clojure_rebl
INFO: Analyzed target //tests/hello_world:hello_world_clojure_rebl (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //tests/hello_world:hello_world_clojure_rebl up-to-date:
  bazel-bin/tests/hello_world/hello_world_clojure_rebl.bat
INFO: Elapsed time: 0.178s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/tests/hello_world/hello_world_clojure_rebl.bat

c:\tmp\mnfgtizy\execroot\_main\BAZEL-~1\X64_WI~1\bin\tests\HELLO_~1\HEF2C6~1.RUN\_main>"..\rules_java~5.3.5~toolchains~local_jdk\bin\java.exe" -Dclojure.main.report=stderr -cp "tests\hello_world\core_clojure_lib.jar;tests\hello_world\libgreet_java_lib.jar;tests\hello_world\math_clojure_lib.jar;..\rules_clojure_maven\v1\https\repo1.maven.org\maven2\org\clojure\clojure\1.11.1\processed_clojure-1.11.1.jar;..\rules_clojure_maven\v1\https\repo1.maven.org\maven2\org\clojure\spec.alpha\0.3.218\processed_spec.alpha-0.3.218.jar;..\rules_clojure_maven\v1\https\repo1.maven.org\maven2\org\clojure\core.specs.alpha\0.2.62\processed_core.specs.alpha-0.2.62.jar;..\rules_clojure_maven\v1\https\repo.clojars.org\cljfmt\cljfmt\0.5.7\processed_cljfmt-0.5.7.jar;..\rules_clojure_maven\v1\https\repo.clojars.org\com\bhauman\rebel-readline\0.1.4\processed_rebel-readline-0.1.4.jar;..\rules_clojure_maven\v1\https\repo.clojars.org\compliment\compliment\0.3.6\processed_compliment-0.3.6.jar;..\rules_clojure_maven\v1\https\repo1.maven.org\maven2\org\clojure\tools.reader\1.3.6\processed_tools.reader-1.3.6.jar;..\rules_clojure_maven\v1\https\repo1.maven.org\maven2\org\jline\jline-reader\3.5.1\processed_jline-reader-3.5.1.jar;..\rules_clojure_maven\v1\https\repo1.maven.org\maven2\org\jline\jline-terminal\3.5.1\processed_jline-terminal-3.5.1.jar;..\rules_clojure_maven\v1\https\repo1.maven.org\maven2\org\jline\jline-terminal-jansi\3.5.1\processed_jline-terminal-jansi-3.5.1.jar;..\rules_clojure_maven\v1\https\repo.clojars.org\rewrite-clj\rewrite-clj\0.5.2\processed_rewrite-clj-0.5.2.jar" clojure.main -e "(require '[hello-world.core]) (in-ns 'hello-world.core)" -e "(use 'clojure.repl)(use 'clojure.java.javadoc)" -m rebel-readline.main
#object[clojure.lang.Namespace 0xd02f8d "hello-world.core"]
Dec 22, 2022 10:02:40 PM org.jline.utils.Log logr
WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
{:clojure.main/message
 "Execution error (ExceptionInfo) at rebel-readline.jline-api/assert-system-terminal (jline_api.clj:53).\r\nUnable to detect a system Terminal, you must not launch the Rebel readline\nfrom an intermediate process.\nIf you are using `lein` you may need to use `lein trampoline`.\r\n",
 :clojure.main/triage
 {:clojure.error/class clojure.lang.ExceptionInfo,
  :clojure.error/line 53,
  :clojure.error/cause
  "Unable to detect a system Terminal, you must not launch the Rebel readline\nfrom an intermediate process.\nIf you are using `lein` you may need to use `lein trampoline`.",
  :clojure.error/symbol
  rebel-readline.jline-api/assert-system-terminal,
  :clojure.error/source "jline_api.clj",
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type clojure.lang.ExceptionInfo,
    :message
    "Unable to detect a system Terminal, you must not launch the Rebel readline\nfrom an intermediate process.\nIf you are using `lein` you may need to use `lein trampoline`.",
    :data {:type :rebel-readline.jline-api/bad-terminal},
    :at
    [rebel_readline.jline_api$assert_system_terminal
     invokeStatic
     "jline_api.clj"
     53]}],
  :trace
  [[rebel_readline.jline_api$assert_system_terminal
    invokeStatic
    "jline_api.clj"
    53]
   [rebel_readline.jline_api$assert_system_terminal
    invoke
    "jline_api.clj"
    51]
   [rebel_readline.jline_api$create_terminal
    invokeStatic
    "jline_api.clj"
    64]
   [rebel_readline.jline_api$create_terminal
    doInvoke
    "jline_api.clj"
    59]
   [clojure.lang.RestFn invoke "RestFn.java" 397]
   [rebel_readline.clojure.main$_main invokeStatic "main.clj" 112]
   [rebel_readline.clojure.main$_main doInvoke "main.clj" 111]
   [clojure.lang.RestFn invoke "RestFn.java" 397]
   [clojure.lang.AFn applyToHelper "AFn.java" 152]
   [clojure.lang.RestFn applyTo "RestFn.java" 132]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$apply invoke "core.clj" 662]
   [rebel_readline.main$_main invokeStatic "main.clj" 6]
   [rebel_readline.main$_main doInvoke "main.clj" 5]
   [clojure.lang.RestFn invoke "RestFn.java" 397]
   [clojure.lang.AFn applyToHelper "AFn.java" 152]
   [clojure.lang.RestFn applyTo "RestFn.java" 132]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.main$main_opt invokeStatic "main.clj" 514]
   [clojure.main$main_opt invoke "main.clj" 510]
   [clojure.main$main invokeStatic "main.clj" 664]
   [clojure.main$main doInvoke "main.clj" 616]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.main main "main.java" 40]],
  :cause
  "Unable to detect a system Terminal, you must not launch the Rebel readline\nfrom an intermediate process.\nIf you are using `lein` you may need to use `lein trampoline`.",
  :data {:type :rebel-readline.jline-api/bad-terminal}}}

Execution error (ExceptionInfo) at rebel-readline.jline-api/assert-system-terminal (jline_api.clj:53).
Unable to detect a system Terminal, you must not launch the Rebel readline
from an intermediate process.
If you are using `lein` you may need to use `lein trampoline`.

Thank you! :)

yesudeep commented 1 year ago

Upgrading to these dependencies appears to address this issue:

        "org.fusesource.jansi:jansi:2.4.0",
        "org.jline:jline-reader:3.21.0",
        "org.jline:jline-terminal-jansi:3.21.0",
        "org.jline:jline-terminal:3.21.0",