-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix/perf: don't call language detection command in enabled() #285
Conversation
I'm also aligning the dotnet segment like other languages segment |
@lnu I suppose you're still working on this, right? |
yes, I put it in draft. It's almost done but there's one thing about the dotnet segment with exit code 145. I'm not able to test it, the tests are ok but I'd like to test it a once manually. |
I think I found something related to the perf issues when calling executables on windows. |
e200eb5
to
e9e7ffd
Compare
Awesome. That's something I didn't check indeed. I have a working rust lib which is faster on Windows when it comes to executing commands. So that combination could be even faster. |
@lnu let me know when this is ready to go. |
7a72fcb
to
006f6c5
Compare
For me it looks fine. But it needs some testing about the languages segment(especially the dotnet one) and a second pair of eyes would be useful. The only difference with the previous behaviour is that hasCommand is called instead of getVersion to check if the segment should be enabled or not. |
006f6c5
to
9176a9a
Compare
4b51add
to
9f7c1f9
Compare
found info here: golang/go#38736 |
The original author did. So we'd have to check with @tillig :-) |
I tried to test it by using a global.json config file with an sdk not installed on my machine:
Here are the results: You can see there's already an issue with the current main branch. A change has been done when trying to optimize I also changed to the dotnet segment to return the unsupported whenever an exit code != 0 is returned by the command. It seems ok to me, maybe @tillig can confirm? |
765af8e
to
4c157be
Compare
145 is actually special for |
4c157be
to
ece6694
Compare
Thank you @tillig. Could you tell me how I could test this? As said above, I put a global.json with a not existing sdk and it returns this: And this global.json:
|
ece6694
to
c9944dc
Compare
Yep. I saw the change but I think we still don't get the right exit code from the command(error output is ok though).
But |
@lnu The bad global.json is how you test it. That should yield both the info you saw and a 145 exit code. |
True. I'll align it with command error. |
|
Unfortunately, I'm on vacation without any real access to a dev environment for another week. Right now I'm on my phone. This isn't something I'll be able to check or help troubleshoot before then. |
You've been already very helpful. Since I kept the exitCode check and all the tests are green, everything should be ok. |
I'll check what does contain the value, I did this rather swift in between taking care of the kids. I can have a look somewhere around lunch. |
I think it's not so urgent :), it can wait until 2021. Happy new year and all the best for you and your family. |
c9944dc
to
0551900
Compare
without wait(), the *ProcessState is nil, meaning we can't access the ExitCode(). On Windows, calling wait() introduces a timeout which makes things run slower, which is why we only call wait() in case of an error. That should not be the main use-case. relates to #285
@lnu found a fix, validated it too. This should hopefully make this ready to merge. Would be cool if we can do this before OEY 😓 |
without wait(), the *ProcessState is nil, meaning we can't access the ExitCode(). On Windows, calling wait() introduces a timeout which makes things run slower, which is why we only call wait() in case of an error. That should not be the main use-case. relates to #285
Cool! Sounds like a deadline? 😅 |
0551900
to
3d2e61b
Compare
Ok so I rebased everything and tested. The exit code is ok and the perf are better. Still, the dotnet segment works correctly under ubuntu but not in windows. But it was already the case before, so we still have the same behaviour. |
3d2e61b
to
ef579e6
Compare
Ill do some testing on this layer today too, that way we can merge with confidence. |
fix: align dotnet segment with other languages feat: missing command text + json schema updated chore: doc updated perf: cache executable path chore: not supported version icon updated(previus one was unreadable)
ef579e6
to
edf1e8d
Compare
@lnu This works fine, I would just remove |
True, no idea what's the point of never displaying the segment. It's also harmless to let it now and clean it later. |
Prerequisites
CONTRIBUTING
guideDescription
Currently, language version detection is done in the enabled() function, which is called in any directory. This call can be avoided by moving the call to get the version inside the string() method. All tests are green and only two had to be modified but not in a way that changes the current behaviour.