RFR: 8304498: JShell does not switch to raw mode when there is no /bin/test

Sean Coffey coffeys at openjdk.org
Wed Mar 22 14:42:33 UTC 2023


On Mon, 20 Mar 2023 12:10:04 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> If JShell is run on a system that does not have `/bin/test` (which is, apparently, possible for some systems, which only have `/usr/bin/test`), it won't switch the terminal into the raw mode, and the input will not work properly.
> 
> The proposed fix herein is to detect whether `test` existing in `/usr/bin/test`, and if yes, use that location. Use the existing `/bin/test` otherwise.

src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/OSUtils.java line 108:

> 106:     private static boolean isTestCommandValid(String command) {
> 107:         try {
> 108:             Process p = new ProcessBuilder(command, "-z", "").inheritIO().start();

is there a reason why you chose to spin up a process here ? Would a test for an executable file be sufficient ?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13100#discussion_r1144922827


More information about the core-libs-dev mailing list