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

Running JShell through Exec task #6

Merged
merged 1 commit into from
Jul 10, 2021
Merged

Conversation

arcesino
Copy link
Contributor

@arcesino arcesino commented Jul 4, 2021

This is a fix for #1. The approach is simply to make the "jshell" task of type Exec and configured it so that it runs the jshell command with the arguments computed by the "jshellSetup" task. The key fix is to set standardInput = System.in when configuring the Exec task which is kind of a known workaround to run interactive command line applications with gradle run.

I've tested this with Gradle 7.1 and OpenJDK 11, 14 & 16 and seems to work correctly although the issue with the arrow keys described in #5 and also here gradle/gradle#4982 (comment) are still present.

This also works with the workaround mentioned in #5 of using rlwrap to make the arrow keys work.

@mrsarm
Copy link
Owner

mrsarm commented Jul 4, 2021

Thanks @arcesino , this looks good! I'll test it tomorrow I hope.

@arcesino arcesino changed the title First working version running JShell through Exec task Running JShell through Exec task Jul 6, 2021
@mrsarm
Copy link
Owner

mrsarm commented Jul 10, 2021

@arcesino your PR works like a charm !! Thanks very much for your contributor, I tried to tackle this problem with different approaches and none worked, and testing your solution with a few projects did work !

After merge going to add a fix more stuff and then release a new version with your patch.

@mrsarm mrsarm merged commit b6aebbb into mrsarm:master Jul 10, 2021
@arcesino
Copy link
Contributor Author

@mrsarm glad to contribute!

mrsarm added a commit that referenced this pull request Jul 12, 2021
- Remove support to old Gradle versions where it's unlikely Java 9+ is used
- Use ~compile~ → implementation (compile is deprecated)
- Remove unused and deprecated JCenter repo
- Upgrade publishing repo plugin
- Remove note about the plugin not working with Java 12+ fixed in #6
- Typo fixes
mrsarm added a commit that referenced this pull request Jul 15, 2021
…nd typo fixes (#7)

Upgrade building conf, README notes and Bump → 1.1.0

- Remove support to old Gradle versions where it's unlikely Java 9+ is used
- Use ~compile~ → implementation (compile is deprecated)
- Remove unused and deprecated JCenter repo
- Upgrade publishing repo plugin
- Bump → 1.1.0
- Remove note about the plugin not working with Java 12+ fixed in #6
- Typo fixes
- Add trick to overcome autocompletion in the README
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.

2 participants