File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
src/main/java/org/jruby/ext/openssl Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 28
28
package org .jruby .ext .openssl ;
29
29
30
30
import java .io .ByteArrayInputStream ;
31
+ import java .io .Console ;
31
32
import java .io .IOException ;
32
33
import java .io .InputStreamReader ;
33
34
import java .io .StringReader ;
@@ -406,6 +407,12 @@ protected static char[] passwordPrompt(final ThreadContext context) {
406
407
}
407
408
408
409
protected static char [] passwordPrompt (final ThreadContext context , final String prompt ) {
410
+ Console console = System .console ();
411
+ if (console != null ) {
412
+ return console .readPassword (prompt );
413
+ }
414
+
415
+ // fall back on simple IO, but may be broken (jruby/jruby#5588)
409
416
final RubyModule Kernel = context .runtime .getKernel ();
410
417
// NOTE: just a fast and simple print && gets - hopefully better than nothing!
411
418
Kernel .callMethod ("print" , context .runtime .newString (prompt ));
You can’t perform that action at this time.
0 commit comments