REPRODUCE:
1. Compile the below program
===>
import java.io.*;
public class Exec {
public static void main( String argv[] ) {
try {
File path = new File("/export/home/java/nosuchdir");
// Specify non-exist dir.
Process process = Runtime.getRuntime().exec( argv, null, path );
BufferedReader br = new BufferedReader(
new InputStreamReader(
process.getInputStream() ) );
String line;
while( (line = br.readLine()) != null )
System.out.println( line );
}
catch( IndexOutOfBoundsException e ) {
System.err.println( "Usage:java ExecTest command [args...]" );
System.exit(-1);
}
catch( Exception e ){
System.err.println( "Error:" + e.toString() );
System.exit(-1);
}
}
}
<===
2. Launch the "java Exec ls"
(This command line try to "ls" command under the specified directory)
Here, no response returns.
Note:
- When the non-exist directory is specified, an exception should be thrown
freeze should not occur.
- When existing directory is specified, the "ls" command is execute
correctly.
CONFIGRATION:
OS : Solaris 7, 8
JDK: 1.4.1-b21/1.4.2-beta-b13
===========================================================================
- duplicates
-
JDK-4842507 (process) Runtime.exec with bogus working dir arg hangs child process (sol)
- Closed
- relates to
-
JDK-4052517 (process) Runtime.exec won't execute programs belonging to other groups on Unix
- Resolved
-
JDK-4790606 (process) Native forkAndExec code should be unified (sol, lnx)
- Resolved
-
JDK-6671051 (process) Runtime.exec() hangs if signalled during fork/exec
- Closed
-
JDK-4784281 (process) Process code leaks processes (sol)
- Closed
-
JDK-6474073 (process) Runtime.exec() creates zombies (sol)
- Closed
-
JDK-6600199 (process) Decode system error messages using platform encoding (unix)
- Closed
-
JDK-4774072 Launcher should cd to /tmp when getcwd() fails
- Closed