RFR: 8272600: (test) Use native "sleep" in Basic.java [v6]

David Holmes dholmes at openjdk.java.net
Wed Sep 22 00:06:58 UTC 2021

On Tue, 21 Sep 2021 13:10:57 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> test/jdk/java/lang/ProcessBuilder/Basic.java line 2217:
>>> 2215:                 // A unique (59s) time is needed to avoid killing other sleep processes.
>>> 2216:                 final String[] cmd = { "/bin/bash", "-c", "(/bin/sleep 59)" };
>>> 2217:                 final String[] cmdkill = { "/bin/bash", "-c", "(/usr/bin/pkill -f \"sleep 59\")" };
>> Maybe future RFE but why do we even need pkill here when we can get the PID of the sleep process we create and kill only that process?
> I thought of that too, but notice the parens "()" around that /bin/sleep; that creates and extra level of forked processes and its harder to get that pid. There probably is a way to traverse the hierarchy but I'll keep it as is for now.

Ah right. Begs the question why we need to use bash to execute sleep? Could it be shell script instead of a binary?


PR: https://git.openjdk.java.net/jdk/pull/5239

More information about the core-libs-dev mailing list