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

fix activate.bat fail on windows #3532

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

NewUserHa
Copy link
Contributor

version: micromamba-2.0.2-0.tar.bz2

curently run activate or activate.bat will end result with:

>> activate
>> micromamba activate
'micromamba' is not recognized as an internal or external command,
operable program or batch file.

the reason is DOSKEY "cannot run a macro from a command that you didn't type in manually" confirmed in docs and other sources eg https://stackoverflow.com/questions/71229141/windows-bat-file-using-start-cmd-k-with-doskey-not-work

this PR fixed it.

@JohanMabille
Copy link
Member

Thanks for your PR. However, I don't understand how this fixes the issue:

  • exe_name.string() returns a string (mamba or micromamba, depending on the executable taht runs shell init) that is inserted in the generate bat file, so in the end the doskey contains a string with the exe name (not an alias or anything else).
  • except on CI where Autorun is specically disabled, micromamba activate works once the shell init has be done (and if micromamba.exe is in th path).

Am I missing something here?

@NewUserHa
Copy link
Contributor Author

the current activate.bat will not work
because after .bat files got generated even there is a DOSKEY micromamba=... in mamba_hook.bat and a fresh cmd called it,
when run activate.bat and the line micromamba activate %* of activate.bat execute, it will error by 'micromamba' is not recognized as an internal or external command, operable program or batch file.,
so this PR updated micromamba(from exe_name.string()) to use mamba(underhood mamba.bat in env) instead, because Macro set by DOSKEY only works in interactive

@JohanMabille
Copy link
Member

Got it! Actually we cannnot hardcode that name to mamba, because there are configuration where we expect a micromamba.bat file (and the mamba.bat will not exist). There is an on-going work in #3546 which should fix it for every use case (mamba / micromamba).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants