-
-
Notifications
You must be signed in to change notification settings - Fork 395
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
Use system calls to get terminal size on Linux / Mac #4497
Open
alexarchambault
wants to merge
28
commits into
com-lihaoyi:0.12.x
Choose a base branch
from
alexarchambault:native-terminal
base: 0.12.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
3548d0a
Use system calls to get terminal size on Linux / Mac
alexarchambault 3932da7
[autofix.ci] apply automated fixes
autofix-ci[bot] 068a0f7
Load jansi native lib ourselves to speed things up
alexarchambault baea11d
Merge branch '0.12.x' into native-terminal
alexarchambault e033ef5
Fix coursier interface version
alexarchambault 253cb6b
Fix
alexarchambault 39f2c86
Add missing coursier codecs
alexarchambault f2fe2d1
Merge branch '0.12.x' into native-terminal
alexarchambault 383cac1
Tweaking
alexarchambault c2a21c1
[autofix.ci] apply automated fixes
autofix-ci[bot] ab5829f
Merge branch '0.12.x' into pr/native-terminal
alexarchambault 9a85417
Merge branch '0.12.x' into pr/native-terminal
alexarchambault c4e8887
Add comments
alexarchambault 302387c
Merge branch '0.12.x' into pr/native-terminal
alexarchambault 1d9cb82
Don't publish jansi in ~/.ivy2/local in integration test
alexarchambault 9ee14f7
Merge branch '0.12.x' into pr/native-terminal
alexarchambault 54b6843
Merge branch '0.12.x' into pr/native-terminal
alexarchambault 16e17be
Merge branch '0.12.x' into pr/native-terminal
alexarchambault c3625e6
debug
alexarchambault ee96932
debug
alexarchambault c525f4a
Adjust logback outfile file upon startup
alexarchambault ba089f6
debug
alexarchambault 813a8b6
fixup Adjust logback outfile file upon startup
alexarchambault b80a92d
Merge branch '0.12.x' into pr/native-terminal
alexarchambault 439a9c1
Revert debug stuff
alexarchambault ad391e1
Make fast path / slow path more explicit
alexarchambault 6802c56
[autofix.ci] apply automated fixes
autofix-ci[bot] bf507e4
debug CI
alexarchambault File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add comments
- Loading branch information
commit c4e888745989ccff79a73552b0fdf9b2f74c4589
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block is pretty messy, and I'm wondering if there's some way we can make it obvious that the fast path is fast and does not classload any heavy libraries. That is the case now, but the fact that it's not obvious from the code makes it likely to regress accidentally if people touch this code.
Perhaps we could do something like what we do for the JVM versions in
mill/runner/client/src/mill/runner/client/MillProcessLauncher.java
Lines 134 to 152 in 392f32d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to try to make that clearer from the code, but it already goes first through a fast path, then through a slower one. The fast path goes from the beginning of the
static {
block up toFile jansiLib = …
. It calls a method oncoursier.paths.CachePath
, but it's a fast thing, that shouldn't load much more coursier classes (the method is here, and it loads that class, which itself loads directories-jvm classes - it's all pure Java classes). It does all that to compute the coursier "archive cache" location (where it unpacks archives), and the location of the jansi dynamic library inside it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I'm aware it currently goes through all lightweight JVM classes, and the manual startup-time benchmarks verify it. But we should refactor the code to make it obvious at a glance at a single if-conditional rather than having to read through 70 lines of imperative code and dig through third-party libraries, otherwise it is prone to regress when someone overlooks it and makes changes later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just put the loading logic aside in a separate class, with two methods,
tryLoadFast
andloadSlow
(did you mean that kind of thing?)