[GRADLE-2310] Can't use System.console() when using the daemon Created: 16/May/12  Updated: 24/Jan/17  Resolved: 24/Jan/17

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Duplicate Votes: 16


 Description   

In this environment, System.console() returns null.

Possible solutions:

1. Inject a console impl to be returned by System.console() that works with the daemon client (not sure if we can inject here)
2. Provide a "Gradle console" object that is daemon aware



 Comments   
Comment by Chris Beams [ 18/Oct/13 ]

I just ran into this as well, and landed here via http://forums.gradle.org/gradle/topics/standard_in_when_using_the_daemon.

It would be most convenient and natural to use System.console() as opposed to rolling one's own with System.in.

Comment by François Guillot [ 09/Apr/15 ]

As the daemon is highly encouraged to be used, with lots of improvements coming thanks to 2.4 release, it would be great to use the console as well.

Comment by Luke Daley [ 10/Apr/15 ]

I'll put it on the list of contenders for 2.5.

The most expedient way of getting something done would be to contribute a fix. If this is something you're interested in, please mention so on the Gradle development list: https://groups.google.com/forum/#!forum/gradle-dev

I don't think this will be too hard to implement. The “hardest” part will be working out the public API for this, as we can't just use the JDK entry points as they are blocked off for extension.

Comment by Thibault Kruse [ 23/Aug/15 ]

+1 for fixing this, it would help my groovysh plugin as well. Maybe I can call System.console() to check whether the daemon is running at all?

Comment by François Guillot [ 24/Aug/15 ]

Note that a simple swingbuilder can be used as a workaround, to query the user's input

Comment by Reinhard Nägele [ 13/Oct/15 ]

I'm on Windows. I only get a console if I run Gradle in a Windows Prompt and the daemon is off. If I run it in Git Bash (which I'd prefer), the console is null.

Comment by Carl-Philipp Harmant [ 04/May/16 ]

Same problem here

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Joern Huxhorn [ 15/Nov/16 ]

This is still an issue.

Comment by SuNova [ 04/Dec/16 ]

Same issue here. I can't use System.in() while using gradle (in Java)
Any fixes?

Comment by Eric Wendelin [ 24/Jan/17 ]

Moved to https://github.com/gradle/gradle/issues/1251

Generated at Wed Jun 30 12:18:28 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.