File tree 1 file changed +6
-3
lines changed
x-pack/plugin/sql/qa/server/src/main/java/org/elasticsearch/xpack/sql/qa/cli
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -215,7 +215,7 @@ public void close() throws IOException {
215
215
out .flush ();
216
216
List <String > nonQuit = new ArrayList <>();
217
217
String line ;
218
- while (true ) {
218
+ while (in . ready () ) {
219
219
line = readLine ();
220
220
if (line == null ) {
221
221
fail ("got EOF before [Bye!]. Extras " + nonQuit );
@@ -297,6 +297,9 @@ public String readLine() throws IOException {
297
297
*
298
298
* `null` means EOF so we should just pass that back through.
299
299
*/
300
+ if (in .ready () == false ) {
301
+ return "" ;
302
+ }
300
303
String line = in .readLine ();
301
304
line = line == null ? null : line .replace ("\u001B " , "" );
302
305
logger .info ("in : {}" , line );
@@ -305,8 +308,8 @@ public String readLine() throws IOException {
305
308
306
309
private String readUntil (Predicate <String > end ) throws IOException {
307
310
StringBuilder b = new StringBuilder ();
308
- String result ;
309
- while (true ) {
311
+ String result = "" ;
312
+ while (in . ready () ) {
310
313
int c = in .read ();
311
314
if (c == -1 ) {
312
315
throw new IOException ("got eof before end" );
You can’t perform that action at this time.
0 commit comments