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

IDEasy not working properly in CMD #764

Closed
hohwille opened this issue Nov 14, 2024 · 7 comments · Fixed by #784, #839 or #886
Closed

IDEasy not working properly in CMD #764

hohwille opened this issue Nov 14, 2024 · 7 comments · Fixed by #784, #839 or #886
Assignees
Labels
bug Something isn't working CLI IDEasy command-line-interface (parsing args, etc.) core FileAccess, ProcessUtil, IdeContext, etc. windows specific for Microsoft Windows OS

Comments

@hohwille
Copy link
Member

Expected behavior

As a IDEasy user on Windows, I want to be able to use IDEasy also in CMD so that I can use it from some *.bat scripts or keep my odd legacy habbits ;)

Actual behavior

grafik

Steps to reproduce (bug) / Use Case of feature request (enhancement)

  1. Install IDEasy
  2. Open CMD
  3. cd to an IDEasy project
  4. run e.g. ide intellij

Related/Dependent Issues

Comments/Hints:

Affected version:

  • OS: Windows
  • IDEasy 2024.11.001-beta-SNAPSHOT
@hohwille hohwille added bug Something isn't working windows specific for Microsoft Windows OS CLI IDEasy command-line-interface (parsing args, etc.) core FileAccess, ProcessUtil, IdeContext, etc. labels Nov 14, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in IDEasy board Nov 14, 2024
@KianRolf KianRolf self-assigned this Nov 15, 2024
@KianRolf KianRolf moved this from 🆕 New to 🏗 In progress in IDEasy board Nov 15, 2024
KianRolf added a commit to KianRolf/IDEasy that referenced this issue Nov 21, 2024
KianRolf added a commit to KianRolf/IDEasy that referenced this issue Nov 21, 2024
KianRolf added a commit to KianRolf/IDEasy that referenced this issue Nov 21, 2024
KianRolf added a commit to KianRolf/IDEasy that referenced this issue Nov 21, 2024
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in IDEasy board Nov 21, 2024
@hohwille hohwille added this to the release:2024.12.001 milestone Nov 21, 2024
@hohwille
Copy link
Member Author

hohwille commented Nov 22, 2024

PR #784 does not fix this problem entirely. Good news is that starting an IDE or any tool where we create a start script for now works from CMD and from BASH.
However, there is something generally broken, when we execute bash scripts in case we have been initially launched from CMD:

D:\projects\IDEasy\software\java\bin>ide install intellij
C:/Program Files/Git/mingw64/libexec/git-core\git-submodule: line 7: basename: command not found
C:/Program Files/Git/mingw64/libexec/git-core\git-submodule: line 7: sed: command not found
C:/Program Files/Git/mingw64/libexec/git-core\git-submodule: line 22: .: git-sh-setup: file not found
Running command 'C:\Program Files\Git\cmd\git.exe' with arguments '--no-pager' 'pull' '--quiet'
failed with exit code 1!
Git pull on branch master failed for repository D:\projects\_ide\urls.
Failed to update git repository at D:\projects\_ide\urls
See above error for details. If you have local changes, please stash or revert and retry.
Typically you should abort and fix the problem. Do you want to continue anyways?
Option 1: yes
Option 2: no

IMHO the shebang detection should be debugged to see what is really going on.
To me it looks as if the bash script is executed by CMD without calling the real git-bash to execute it.

Workaround: Do not use CMD at all as suggested in the documentation.
However, we still need to fix this.

@hohwille hohwille reopened this Nov 22, 2024
@hohwille hohwille removed this from the release:2024.12.001 milestone Dec 10, 2024
@hohwille hohwille linked a pull request Dec 10, 2024 that will close this issue
@hohwille
Copy link
Member Author

Seems to be closely related to devonfw/ide#1395

@hohwille hohwille assigned alfeilex and unassigned KianRolf Dec 10, 2024
@alfeilex
Copy link
Member

alfeilex commented Dec 10, 2024

There are not problems using CMD to run ide intellij on Win 10.

Tested with version: ide-cli-2024.12.001-beta-20241210.023937-17-windows-x64.tar.gz

Git Version: 2.39.1

@alfeilex
Copy link
Member

alfeilex commented Dec 10, 2024

But if I run ide create <project>, I get this error:

Cloning into '.'...
remote: Enumerating objects: 1296, done.
remote: Counting objects: 100% (327/327), done.
remote: Compressing objects: 100% (147/147), done.
Receiving objects: 100% (1296/1296), 236.80 KiB | 2.85 MiB/s, done. 969 (from 1)

Resolving deltas: 100% (501/501), done.
C:/Program Files/Git/mingw64/libexec/git-core\git-submodule: line 22: .: git-sh-setup: file not found
Running command 'C:\Program Files\Git\bin\git.exe' with arguments 'clone' '--recursive' 'https://github.com/devonfw/ide-settings.git' '--config' 'core.autocrlf=false' '.'
failed with exit code 1!
Step 'Clone settings repository' ended with failure.
Step 'ide (create,test)' failed: com.devonfw.tools.ide.cli.CliProcessException: Command git.exe failed with exit code 1 - full commandline was C:\Program Files\Git\bin\git.exe clone --recursive https://github.com/devonfw/ide-settings.git --config core.autocrlf=false .
 Step 'Clone settings repository' failed: unexpected error
2 step(s) failed out of 2 steps.
Command git.exe failed with exit code 1 - full commandline was C:\Program Files\Git\bin\git.exe clone --recursive https://github.com/devonfw/ide-settings.git --config core.autocrlf=false .

IDE environment variables have been set for C:\projects\dev-project in workspace main

I could fix this error by following this advice: https://stackoverflow.com/a/50833818

It was enough to add C:\Program Files\Git\mingw64\libexec\git-core to the PATH since I already had C:\Program Files\Git\bin in it

@hohwille
Copy link
Member Author

@alfeilex thanks for your workaround.
See also:
ionic-team/ionic-framework#12165

We should discuss if either our setup.bat script should fix this and add the missing PATH entries (invasive), or even better change ide.bat to do it transient.
To find the correct PATH to git installation see:
https://github.com/devonfw/ide/blob/8698d2ba7468d34aec82c86fabdb09b5ee84d9c8/scripts/src/main/resources/scripts/devon.bat#L38-L44

@hohwille
Copy link
Member Author

D:\projects\IDEasy>where basename
INFORMATION: Es konnten keine Dateien mit dem angegebenen
Muster gefunden werden.

D:\projects\IDEasy>set PATH=%PATH%;C:\Program Files\Git\usr\bin

D:\projects\IDEasy>where basename
C:\Program Files\Git\usr\bin\basename.exe

@alfeilex
Copy link
Member

D:\projects\IDEasy>set PATH=%PATH%;C:\Program Files\Git\usr\bin

I had to add C:\Program Files\Git\mingw64\libexec\git-core as well, because otherwise git-sh-setup wasn't found when creating a project.

@alfeilex alfeilex moved this from ✅ Done to 🏗 In progress in IDEasy board Dec 10, 2024
alfeilex added a commit to alfeilex/IDEasy that referenced this issue Dec 10, 2024
@hohwille hohwille added this to the release:2024.12.002 milestone Dec 12, 2024
jan-vcapgemini added a commit to alfeilex/IDEasy that referenced this issue Dec 13, 2024
alfeilex added a commit to alfeilex/IDEasy that referenced this issue Dec 16, 2024
alfeilex added a commit to alfeilex/IDEasy that referenced this issue Dec 17, 2024
alfeilex added a commit to alfeilex/IDEasy that referenced this issue Dec 17, 2024
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in IDEasy board Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CLI IDEasy command-line-interface (parsing args, etc.) core FileAccess, ProcessUtil, IdeContext, etc. windows specific for Microsoft Windows OS
Projects
Status: ✅ Done
3 participants