Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not all versions of Linux have /bin/test #839

Closed
lahodaj opened this issue Mar 29, 2023 · 1 comment · Fixed by #853 or #854
Closed

Not all versions of Linux have /bin/test #839

lahodaj opened this issue Mar 29, 2023 · 1 comment · Fixed by #853 or #854
Milestone

Comments

@lahodaj
Copy link
Contributor

lahodaj commented Mar 29, 2023

The org.jline.terminal.impl.exec.ExecTerminalProvider uses a test program to detect if a stream is attached to a terminal:

Process p = new ProcessBuilder(OSUtils.TEST_COMMAND, "-t", Integer.toString(stream.ordinal()))

The test program appears to be hardcoded to /bin/test:

But, there appear to be some versions of Linux that use /usr/bin/test rather than /bin/test, which then leads to misdetection of the terminal streams as non-terminal, and then JLine won't switch to raw mode, and input does not work properly.

Inside OpenJDK, this lead to:
openjdk/jdk@fab2357

@gnodet
Copy link
Member

gnodet commented Mar 29, 2023

Maybe using something like:

test = Files.exists(Paths.get("/bin/test")) ? "/bin/test" : "/usr/bin/test";

@gnodet gnodet added this to the 2.23.1 milestone Jul 31, 2023
gnodet added a commit to gnodet/jline3 that referenced this issue Jul 31, 2023
@gnodet gnodet mentioned this issue Aug 1, 2023
gnodet added a commit that referenced this issue Aug 1, 2023
@gnodet gnodet mentioned this issue Aug 2, 2023
@mattirn mattirn modified the milestones: 2.23.1, 3.23.1 Aug 29, 2023
@gnodet gnodet modified the milestones: 3.23.1, 3.24.0 Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants