jbangdev / jbang

Unleash the power of Java - JBang Lets Students, Educators and Professional Developers create, edit and run self-contained source-only Java programs with unprecedented ease.
https://jbang.dev
MIT License
1.43k stars 159 forks source link

handle debug output messing up jbangdev #1572

Open maxandersen opened 1 year ago

maxandersen commented 1 year ago

if you run with JBANG_JAVA_OPTIONS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5555

an error occurs like:

/Users/manderse/code/jbangdev/jbang/build/install/jbang/bin/jbang: line 230: exec: Listening: not found

because the output contains the following:

Listening for transport dt_socket at address: 5555
/Users/manderse/.jbang/cache/jdks/11/bin/java '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5555' -classpath /Users/manderse/.jbang/cache/jars/env.java.a9698542287f63ccc8120cf14c41e464b3d015626675bbe06bcca02faaea47d1/env.jar:/Users/manderse/.m2/repository/info/picocli/picocli/4.2.0/picocli-4.2.0.jar:/Users/manderse/.m2/repository/de/vandermeer/asciitable/0.3.2/asciitable-0.3.2.jar:/Users/manderse/.m2/repository/de/vandermeer/ascii-utf-themes/0.0.1/ascii-utf-themes-0.0.1.jar:/Users/manderse/.m2/repository/de/vandermeer/skb-interfaces/0.0.1/skb-interfaces-0.0.1.jar:/Users/manderse/.m2/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar:/Users/manderse/.m2/repository/org/antlr/ST4/4.0.8/ST4-4.0.8.jar:/Users/manderse/.m2/repository/org/antlr/antlr-runtime/3.5.2/antlr-runtime-3.5.2.jar:/Users/manderse/.m2/repository/org/antlr/antlr4/4.5.1/antlr4-4.5.1.jar:/Users/manderse/.m2/repository/org/slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.jar:/Users/manderse/.m2/repository/de/vandermeer/char-translation/0.0.2/char-translation-0.0.2.jar:/Users/manderse/.m2/repository/org/jline/jline/3.16.0/jline-3.16.0.jar env xyz

I wonder if we could strip out first line if it starts with "Listening" or we should simply just execute the last line ?

quintesse commented 1 year ago

That might be doable on Linux and Mac, but really hard on Windows. It's already a miracle it works on Windows anyway.

quintesse commented 1 year ago

Btw, the solution is to add quiet=y to the options.