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

Windows support broken (CMD to bash breaks PATH) #49

Closed
hohwille opened this issue Mar 26, 2019 · 3 comments
Closed

Windows support broken (CMD to bash breaks PATH) #49

hohwille opened this issue Mar 26, 2019 · 3 comments
Labels
bug Something isn't working scripts related to shell scripts (bash and CMD) windows specific for Microsoft Windows OS
Milestone

Comments

@hohwille
Copy link
Member

Due to the fix of #27 I broke the windows support unfortunately.
When devon is called with additional params in CMD then the BAT script delegates to the devon bash scripts in git-bash. As the variables from windows CMD are then passed to bash also DEVON_OLD_PATH remains set. This causes the devon bash script to reset the PATH to DEVON_OLD_PATH what unsets the "unix" path in bash so dirname, basename, cp, mkdir, etc. are all no longer available and scripts fail.

@hohwille hohwille added bug Something isn't working windows specific for Microsoft Windows OS scripts related to shell scripts (bash and CMD) labels Mar 26, 2019
@hohwille hohwille added this to the release:3.0.0 milestone Mar 26, 2019
@hohwille
Copy link
Member Author

The problem is that *.bat script logic is so limited (or in other words such a pile of crap) that I can not properly filter the path to remove any previous entries from a devon-ide.
Thus for simplicity I decided to save a backup of the previous PATH in DEVON_OLD_PATH so that I can reset the PATH.
Hence, I think I need to unset the PATH and DEVON_OLD_PATH before switching from windows CMD world to bash world. Afterwards I might need to reset it.
Further, on windows there is git bash that uses the same home directory as windows is using while there is also cygwin that uses a separate home directory. When calling the scripts for the first time (on setup) this might be the first time that devon-ide comes to the system at all. Hence devon CLI is not yet installed and available. Therefore I can not call bash with -c 'devon %*' as devon has to be installed first. I could provide the absolute path to the devon bash script from the devon.bat script but I shall not change PWD/CWD as some commands require to be called in the current directory. Not can I provide an absolute path as I only know the Windows path (e.g. C:\projects\my-ide\scripts\devon) but would need to transform it to a unix path and that will differ per Bash (/c/projects/my-ide/scripts/devon vs. /cygdrive/c/my-ide/scripts/devon). I would like to keep things simple, robust and reliable. But this windows crap is really making it much more tricky than expected...

@hohwille
Copy link
Member Author

KISS would be to drop *.bat support at all. But convincing all windows users to use bash instead sounds like a relegious act that I am not keen on either.

hohwille added a commit that referenced this issue Mar 26, 2019
* #45: add IntelliJ support, small other improvements for IDEs

* #29: removed tomcat (WST)

* #21: fixed various windows bugs

* #21: improved windows support

* #21: updated iTerm2 workflow

* #21: updated Terminal workflow

* #49: fix/workaround

* #49: allow to see results/errors
@hohwille hohwille mentioned this issue Mar 27, 2019
hohwille added a commit that referenced this issue Mar 27, 2019
* #49: proper fix for BAT world

* #49: proper fix for bash world

* small fix for archetype
@Daer7
Copy link

Daer7 commented May 22, 2024

Hi @hohwille, I experienced a similar problem in the newest version of the framework when running Git Bash from the IntelliJ shipped with devon. Upon starting the shell my .bashrc executes source ~/.devon/devon and I end up with a weird PATH being a mixture of bash-style and Windows-style entries like so:

<DEVON-HOME>/software/vscode/bin:<DEVON-HOME>/software/tomcat/bin:<DEVON-HOME>/software/sqlplus:<DEVON-HOME>/software/python:<DEVON-HOME>/software/project-ide-scripts:<DEVON-HOME>/software/node:<DEVON-HOME>/software/mvn/bin:<DEVON-HOME>/software/java/bin:<DEVON-HOME>/software/intellij/bin:<DEVON-HOME>/software/helm:<DEVON-HOME>/software/eclipse:C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\<MYUSERNAME>\bin;C:\Program Files\Eclipse Adoptium\jdk-19.0.2.7-hotspot\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\PuTTY;C:\Program Files\Git\cmd;C:\Program Files\NVM;C:\Program Files\nodejs;C:\Program Files\Rancher Desktop\resources\resources\win32\bin;C:\Program Files\Rancher Desktop\resources\resources\linux\bin;C:\Program Files\nodejs;C:\Users\<MYUSERNAME>\AppData\Local\Microsoft\WindowsApps;C:\Users\<MYUSERNAME>\scripts;C:\Program Files\JetBrains\IntelliJ IDEA 2024.1.1\bin;C:\skaffold

Strangely, unix-like tools like ls, tail got removed (no entries such as /mingw64/bin:/usr/local/bin:/usr/bin:/bin in the PATH anymore), so what gets printed on top of my terminal window with Git Bash before the command prompt appears is:

bash: tail: command not found
bash: wc: command not found
bash: test: : integer expression expected
devonfw-ide environment variables have been set for <DEVON-HOME> in workspace main
...
$

This shell becomes thus unusable. My workaround for now (without analysing in detail) is to comment out the lines manipulating DEVON_OLD_PATH which seem to be the problem in my case.


devon version 2024.01.001
OS: Windows 11 Pro 10.0.22631 Build 22631

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working scripts related to shell scripts (bash and CMD) windows specific for Microsoft Windows OS
Projects
None yet
Development

No branches or pull requests

2 participants