On Tue, 21 Sep 2021 13:10:57 GMT, Roger Riggs <[email protected]> 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