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

Still log messages break processable command output #627

Closed
hohwille opened this issue Sep 17, 2024 · 4 comments · Fixed by #649
Closed

Still log messages break processable command output #627

hohwille opened this issue Sep 17, 2024 · 4 comments · Fixed by #649
Assignees
Labels
bug Something isn't working

Comments

@hohwille
Copy link
Member

$ ide -v
Updates are available for the settings repository. If you want to pull the latest changes, call ide update.
2024.09.002-beta-SNAPSHOT
bash: Updates: command not found

I have fixed #531 already two times.
It seems that also issue #161 with PR #467 also broke this.
I still do not understand how this happens since I thought my second fix was bullet proof.
Is that output printed with System.out or what could I be missing?

@hohwille hohwille added the bug Something isn't working label Sep 17, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in IDEasy board Sep 17, 2024
@hohwille hohwille added this to the release:2024.09.002 milestone Sep 17, 2024
@alfeilex alfeilex self-assigned this Sep 18, 2024
@alfeilex alfeilex moved this from 🆕 New to 🏗 In progress in IDEasy board Sep 18, 2024
@alfeilex
Copy link
Member

As I understand, the problem relies in

info("Updates are available for the settings repository. If you want to pull the latest changes, call ide update.");
because after executing env --bash, bash thinks that that log message is an executable command.

Maybe one of these solutions can help us to prevent that behavior:

  • Append # to the log message and treat it as a comment
  • Redirect the info log level to stderr if env --bash is run
  • Using some sed, grep workarounds but I don't know if that makes things more complicated

@alfeilex
Copy link
Member

I tried to use interaction() instead of info() but the result is the same. First of all interaction log level is supressed by

if (level != IdeLogLevel.INFO) {
this.startContext.setLogLevel(level, false);
and I had to extend the condition with .. && level != IdeLogLevel.INTERACTION

But the end result is the same after executing ide -v with output bash: $'\E[96mUpdates': command not found

Am I missing something?

@hohwille
Copy link
Member Author

and I had to extend the condition with .. && level != IdeLogLevel.INTERACTION

You should not do that. This code should deactivate all loglevels EXCEPT the Log-Level INFO.
Hence, when you are logging in INTERACTION instead of INFO, the output should be hidden.

BTW: Even smarter would be to move this check to a method that is executed only if the command to run returns false on isProcessableOutput(). In that case the log-level does not matter and we also do not waste performance to determine information from GIT that we then omit in the logging.

@hohwille
Copy link
Member Author

fixed by changing log-level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

2 participants