-
Notifications
You must be signed in to change notification settings - Fork 34
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
#400: ide output outside IDEasy installation #405
#400: ide output outside IDEasy installation #405
Conversation
Pull Request Test Coverage Report for Build 9610922840Details
💛 - Coveralls |
@@ -200,7 +198,7 @@ public AbstractIdeContext(IdeLogLevel minLogLevel, Function<IdeLogLevel, IdeSubL | |||
} | |||
} | |||
if (ideRootPath == null || !Files.isDirectory(ideRootPath)) { | |||
error("IDE_ROOT is not set or not a valid directory."); | |||
error("You are not inside an IDEasy installation: " + System.getProperty("user.dir")); |
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.
Actually this is a different error/warning. Even if IDE_HOME is not found because you are outside of an IDEasy project, the installer should set a environment variable IDE_ROOT on your OS (e.g. in Windows environment variables for user).
What you are actually looking for is this one:
return "You are not inside an IDE installation: " + this.cwd; |
It is already printed here:
IDEasy/cli/src/main/java/com/devonfw/tools/ide/context/AbstractIdeContext.java
Lines 183 to 184 in ee596da
if (currentDir == null) { | |
info(getMessageIdeHomeNotFound()); |
IMHO we need to investigate this further, because you removed the actual code that should print the expected message.
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 rather think that the only problem is that info
needs to be changed to error
since the first is writing to standard out while the latter is writing to standard error.
Standard out is written into the variable for the variables to set using eval
command.
If the exit code is not 0 that output is discarded by wrapper script.
You can test that is works properly in IntelliJ but the output is hidden by the wrapper script.
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.
changed info to error, the log was printed anyways two times.
I went for this new solution that avoids redundant code as well (calling getMessageIdeHomeNotFound()
two times) :
- if (ideRootPath == null || !Files.isDirectory(ideRootPath)) {
- error("IDE_ROOT is not set or not a valid directory.");
- }
+ if (ideRootPath == null || !Files.isDirectory(ideRootPath) || currentDir != null) {
+ error(getMessageIdeHomeNotFound());
+ }
- Note:
getMessageIdeHomeNotFound()
hat to be changed because in some casesthis.cwd
was equal to null
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 already fixed this in PR #424 so that would replace this PR.
However, there is a strange bug happening on github that cannot be reproduced locally on any OS including linux preventing the merge of PR #424. Since I do not have time currently to investigate this further, I wanted to merge this PR and later rebase PR #424.
However, this is still incorrect: There are two more or less independent warnings:
- IDE_ROOT is not defined
- IDE_HOME is required but not defined
I do not see a duplication of messages and still think you are removing an error log message that was still intended.
$ ideasy --env
You are not inside an IDE installation: null
IDE_ROOT is not set or not a valid directory.
The actual problem is the null
and the fact that our wrapper script is kind of buggy or the log-level of the IdeHome message is info but should be error.
Maybe I can find the time to reduce one of my PRs and get the actual bash-completion stuff out until it gets green and I can reuse it to fix #400. That would most probably be the best way to go to get this all sorted out quickly...
Pull Request Test Coverage Report for Build 9694897319Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9694945996Details
💛 - Coveralls |
Fixes: #400
https://github.com/mvomiero/IDEasy/blob/f5b0765bd3099ca647db9430f35a4b4454f69c3f/cli/src/main/java/com/devonfw/tools/ide/context/AbstractIdeContext.java#L184