test/java/lang/Runtime/exec/ExitValue.java
Print this page
*** 66,76 ****
public static void checkPosixShellExitValue(String posixShellProgram,
int expectedExitValue)
throws Exception
{
! checkExitValue(new String[] { "/bin/sh", "-c", posixShellProgram },
expectedExitValue);
}
final static int EXIT_CODE = 5;
--- 66,76 ----
public static void checkPosixShellExitValue(String posixShellProgram,
int expectedExitValue)
throws Exception
{
! checkExitValue(new String[] { UnixCommands.sh(), "-c", posixShellProgram },
expectedExitValue);
}
final static int EXIT_CODE = 5;
*** 83,102 ****
{ java,
"-classpath", System.getProperty("test.classes", "."),
"ExitValue$Run", String.valueOf(EXIT_CODE)
}, EXIT_CODE);
! checkExitValue(new String[] { "/bin/true" }, 0);
checkPosixShellExitValue("exit", 0);
checkPosixShellExitValue("exit 7", 7);
! if (new File("/bin/kill").exists()) {
int sigoffset =
System.getProperty("os.name").equals("SunOS") ? 0 : 128;
! checkPosixShellExitValue("/bin/kill -9 $$", sigoffset+9);
}
}
public static class Run {
public static void main (String[] argv) {
--- 83,102 ----
{ java,
"-classpath", System.getProperty("test.classes", "."),
"ExitValue$Run", String.valueOf(EXIT_CODE)
}, EXIT_CODE);
! checkExitValue(new String[] { UnixCommands.findCommand("true") }, 0);
checkPosixShellExitValue("exit", 0);
checkPosixShellExitValue("exit 7", 7);
! if (new File(UnixCommands.kill()).exists()) {
int sigoffset =
System.getProperty("os.name").equals("SunOS") ? 0 : 128;
! checkPosixShellExitValue(UnixCommands.kill() + " -9 $$", sigoffset+9);
}
}
public static class Run {
public static void main (String[] argv) {