8028094: TEST_BUG: java/lang/ProcessBuilder/Basic.java leaves "sleep 6666" processes behind
authorbvaidya
Tue, 19 Nov 2013 15:31:33 +0000
changeset 21813 f7e97f5bb5a2
parent 21812 c43ac963db3d
child 21815 9613e4a03175
8028094: TEST_BUG: java/lang/ProcessBuilder/Basic.java leaves "sleep 6666" processes behind Reviewed-by: chegar
jdk/test/java/lang/ProcessBuilder/Basic.java
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java	Tue Nov 19 07:10:06 2013 -0800
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java	Tue Nov 19 15:31:33 2013 +0000
@@ -2016,6 +2016,7 @@
                 && new File("/bin/bash").exists()
                 && new File("/bin/sleep").exists()) {
                 final String[] cmd = { "/bin/bash", "-c", "(/bin/sleep 6666)" };
+                final String[] cmdkill = { "/bin/bash", "-c", "(/usr/bin/pkill -f \"sleep 6666\")" };
                 final ProcessBuilder pb = new ProcessBuilder(cmd);
                 final Process p = pb.start();
                 final InputStream stdout = p.getInputStream();
@@ -2043,6 +2044,7 @@
                 stdout.close();
                 stderr.close();
                 stdin.close();
+                new ProcessBuilder(cmdkill).start();
                 //----------------------------------------------------------
                 // There remain unsolved issues with asynchronous close.
                 // Here's a highly non-portable experiment to demonstrate: