Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4960438
Votes 3
Synopsis (process) Need IO redirection API for subprocesses
Category java:classes_lang
Reported Against 1.4.2_02 , tiger-rc , tiger-beta
Release Fixed 7(b25)
State 10-Fix Delivered, request for enhancement
Priority: 3-Medium
Related Bugs 4957071 , 6423785 , 6481278 , 6631352 , 6631353 , 6636526 , 5074560
Submit Date 26-NOV-2003
Description
The output (stdout and stderr) of a process started via
Runtime.exec() or ProcessBuilder.start() is always directed to a pipe
that can only be read by the creating Java process.

We need to be able to re-create the functionality that comes standard
with most command processors
command > filename  # redirect subprocess output into a file
command             # subprocess output goes to same location as parent output
Work Around
On a particular platform, one can usually work around this using a shell
script or similar mechanism

new ProcessBuilder("/bin/sh", "-c", "command > file 2>&1").start();

  xxxxx@xxxxx   2003-11-26
Evaluation
Intuitively, the stdout and stderr of a child process should simply
be settable attributes of ProcessBuilder().  But you can't pass
a stream, because non-Java children couldn't understand that; 
you have to pass a lower-level object like a FileDescriptor.

  xxxxx@xxxxx   2003-11-26
Comments
  
  Include a link with my name & email   

Submitted On 12-JUN-2007
mthornton
A platform independent way of redirecting these output streams to the null device would also be useful (i.e. NUL on windows, /dev/null on *nix).



PLEASE NOTE: JDK6 is formerly known as Project Mustang