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

ProcessBuilder execution for command with pipe fails.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 7u21
    • core-libs

      FULL PRODUCT VERSION :
      1.7.0_21

      ADDITIONAL OS VERSION INFORMATION :
      Windows 7 Professional 64 Bit
      Service Pack 1

      A DESCRIPTION OF THE PROBLEM :
      The ProcessBuilder ignores a pipe symbol (>) in the DIR command.
      The command " cmd /c dir c: > c:/dir.txt " should create the file c:/dir.txt.
      Since jdk7u21 the file is not created. No exceptions are thrown.

      REGRESSION. Last worked in version 7u17

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and execute the specified source code.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The file c:/dir.txt should be created.
      ACTUAL -
      No file created.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.IOException;

      public class JavaTest {
      public static void main(String[] args) {
      try {
      ProcessBuilder builder = new ProcessBuilder( " cmd " , " /c " , " dir " , " c: " , " > " , " c:/dir.txt " );
      builder.start();
      } catch (IOException e) {
      e.printStackTrace();
      }
      }
      }
      ---------- END SOURCE ----------

            uta Alexey Utkin (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: