jshell-plugin icon indicating copy to clipboard operation
jshell-plugin copied to clipboard

no new line before use of println

Open joprice opened this issue 4 years ago • 4 comments

When writing to stdout using for instance System.out.println, the line is printed as appended to the end of the line, instead of on a new line of its own:

println(1)1

I would expect a new line after println:

println(1)
1

joprice avatar Dec 15 '21 23:12 joprice

Sorry to not reply before, and yes, I'm aware of that error, some times not sure why it doesn't happens but most of the times it does.

The problem is Gradle and its pour support for managing I/O in the console, check this https://github.com/mrsarm/jshell-plugin/issues/2.

We were talking today in another issue how limited is to run JShell from Gradle and it would be ideal to run the process outside Gradle to solve this and other problems (https://github.com/mrsarm/jshell-plugin/issues/12#issuecomment-1035093443), but for now, I'm limited of time to work on it :disappointed: .

mrsarm avatar Feb 11 '22 02:02 mrsarm

Is it a same problem? Any workaround?

I used this version:

// build.gradle
plugins {
    id 'com.github.mrsarm.jshell.plugin' version '1.2.1'
}

The actual result differs from the expected:

$ rlwrap ./gradlew --no-daemon --console plain jshell

# Expected
jshell> new String("Hello");
$1 ==> "Hello"

# Actual
jshell> new String("Hello");
new String("Hello")$1 ==> "Hello"

While in a vanilla jshell:

$ jshell

jshell> new String("Hello");
$1 ==> "Hello"

appkr avatar Jul 24 '23 01:07 appkr

Hi @appkr , no, there is no workaround at the moment :disappointed:

mrsarm avatar Jul 25 '23 14:07 mrsarm

@mrsarm Thanks for the clarification.

appkr avatar Jul 26 '23 07:07 appkr