diff --git a/test/jdk/java/lang/RuntimeTests/exec/SleepyCat.java b/test/jdk/java/lang/RuntimeTests/exec/SleepyCat.java index 7e6e9837c40..9ab4ba33f45 100644 --- a/test/jdk/java/lang/RuntimeTests/exec/SleepyCat.java +++ b/test/jdk/java/lang/RuntimeTests/exec/SleepyCat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,26 +66,19 @@ public class SleepyCat { * @param pids the processes to dump status for */ static void dumpState(Process... pids) { - if (!System.getProperty("os.name").contains("SunOS")) { - return; - } try { String[] psArgs = {"ps", "-elf"}; - Process ps = new ProcessBuilder(psArgs).inheritIO().start(); - ps.waitFor(); - String[] sfiles = {"pfiles", "self"}; - Process fds = new ProcessBuilder(sfiles).inheritIO().start(); - fds.waitFor(); + try (Process ps = new ProcessBuilder(psArgs).inheritIO().start()) { + ps.waitFor(); + } for (Process p : pids) { if (p == null) continue; - String[] pfiles = {"pfiles", Long.toString(p.pid())}; - fds = new ProcessBuilder(pfiles).inheritIO().start(); - fds.waitFor(); - String[] pstack = {"pstack", Long.toString(p.pid())}; - fds = new ProcessBuilder(pstack).inheritIO().start(); - fds.waitFor(); + String[] pfiles = {"lsof", "-p", Long.toString(p.pid())}; + try (Process fds = new ProcessBuilder(pfiles).inheritIO().start()) { + fds.waitFor(); + } } } catch (IOException | InterruptedException i) { i.printStackTrace(); diff --git a/test/jdk/java/lang/RuntimeTests/exec/TEST.properties b/test/jdk/java/lang/RuntimeTests/exec/TEST.properties new file mode 100644 index 00000000000..c7e8a6850ca --- /dev/null +++ b/test/jdk/java/lang/RuntimeTests/exec/TEST.properties @@ -0,0 +1 @@ +maxOutputSize=6000000