< prev index next >

test/java/lang/ProcessBuilder/Zombies.java

Print this page




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 6474073

  27  * @summary Make sure zombies don't get created on Unix
  28  * @author Martin Buchholz
  29  */
  30 
  31 import java.io.*;
  32 
  33 public class Zombies {
  34 
  35     static final String os = System.getProperty("os.name");
  36 
  37     static final String TrueCommand = os.contains("OS X")?
  38         "/usr/bin/true" : "/bin/true";
  39 
  40     public static void main(String[] args) throws Throwable {
  41         if (! new File("/usr/bin/perl").canExecute() ||
  42             ! new File("/bin/ps").canExecute())
  43             return;
  44         System.out.println("Looks like a Unix system.");
  45         long mypid = ProcessHandle.current().getPid();
  46         System.out.printf("mypid: %d%n", mypid);




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 6474073
  27  * @key intermittent
  28  * @summary Make sure zombies don't get created on Unix
  29  * @author Martin Buchholz
  30  */
  31 
  32 import java.io.*;
  33 
  34 public class Zombies {
  35 
  36     static final String os = System.getProperty("os.name");
  37 
  38     static final String TrueCommand = os.contains("OS X")?
  39         "/usr/bin/true" : "/bin/true";
  40 
  41     public static void main(String[] args) throws Throwable {
  42         if (! new File("/usr/bin/perl").canExecute() ||
  43             ! new File("/bin/ps").canExecute())
  44             return;
  45         System.out.println("Looks like a Unix system.");
  46         long mypid = ProcessHandle.current().getPid();
  47         System.out.printf("mypid: %d%n", mypid);


< prev index next >