Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8202428

jshell tool: locks up

XMLWordPrintable

    • x86_64
    • linux_ubuntu

      ADDITIONAL SYSTEM INFORMATION :
      Java 10 install from PPA as described in https://stackoverflow.com/questions/49507160/how-to-install-jdk-10-under-ubuntu?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa.

      A DESCRIPTION OF THE PROBLEM :
      See below.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Snippet code:

      class SH{
          ProcessBuilder pb;
          Process p;

          BufferedWriter to_subp;
          String ts;

          BufferedReader from_subp;
          String fs;

          SH(){
              try{
              pb = new ProcessBuilder("/bin/sh");
              pb.redirectErrorStream(true);
              p=pb.start();
              
             from_subp = new BufferedReader(
                          new InputStreamReader(
                          p.getInputStream()));
              
              to_subp = new BufferedWriter(
                          new OutputStreamWriter(
                          p.getOutputStream()));
              } catch (Exception ex) {
                  ex.printStackTrace();
              }
          }

          void sh(String cmd){
              try {
                  while ((fs = from_subp.readLine()) != null){
                      System.out.println(fs);
                  }
              } catch (Exception ex) {
                  ex.printStackTrace();

              }
          }
       }

      SH sh=new SH()

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Run 'jshell> sh.sh("ls")'. Lockup happens.
      Type Ctrl-C to remove the lockuped code and go back to jshell.

      ACTUAL -
      Run 'jshell> sh.sh("ls")'. Lockup happens.
      Close the /bin/sh, which is dash on my Ubuntu, from which I started jshell, start a new terminal, start jshell, and only then be back to jshell normal operation.

      ---------- BEGIN SOURCE ----------
      See Steps to Reproduce above.
      ---------- END SOURCE ----------

      FREQUENCY : always


            jlahoda Jan Lahoda
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: