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

OutputStream doesn't communicate with exec'd Process

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P5 P5
    • None
    • 1.1.1
    • core-libs
    • x86
    • windows_nt



      Name: mc57594 Date: 06/17/97


      1) run the java program 2b) compiling with either 1.1 or 1.1.1 and it will hang after "Flushed it". All the evidence indicates that the perl script never sees any input. The problem is easily reproduced with a java program in place of the perl script. Makes the Sun Java Server Beta unusable on NT 3.5.1 or NT 4.0 with cgi scripts.

      2a) Following perl script:
      #! perl
      print "hello\n";
      read(STDIN, $args, 100);
      print OUTPUT $args;
      print $args;
      close(OUTPUT);

      2b) The following java:
      public class testExec {
        public static void main(String[] args) {
          Process process;
          String[] command = new String[] {"c:\\NTResKit\\Perl\\perl",
      "-x", "ein.pl"};

          try {
            process = Runtime.getRuntime().exec(command);
      System.out.println("Ran it");
            InputStream in = process.getInputStream();
            BufferedReader brin = new BufferedReader(new InputStreamReader(in));
            OutputStream out = process.getOutputStream();
            BufferedWriter bout = new BufferedWriter(new OutputStreamWriter(out));

            bout.write("This is an output\n");
      System.out.println("Wrote it");
            bout.flush();
      System.out.println("Flushed it");
            System.out.println(brin.readLine());
      System.out.println("Read it");
          } catch (IOException e) {
            e.printStackTrace();
            return;
          }
        }
      }



      ======================================================================

            apalanissunw Anand Palaniswamy (Inactive)
            mchamnessunw Mark Chamness (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: