Open anjannath opened 1 year ago
:thinking: that would be similar to use the env var SHELL
no? , or you mean you can specify any shell even the not supported ones?
I mean crc should detect the shell correctly as bash
or zsh
, etc. when running in a WSL terminal and not detect is as cmd
that would be similar to use the env var SHELL no?
it doesn't work on WSL, there's a $SHELL
env variable already set but crc is not using it, probably because the env variables are being fetched from the host when we are using os.Getenv
the issue here is kinda that while we detect zsh/bash, we might not be able to properly set this up, unless we can guarantee the communication works from crc.exe
and WSL, as it should also run in that case oc.exe
or the linux binary oc
? and in that case, we might end up with another issue; people expecting that crc.exe start
will work properly; this might be the case, but what if a side-effect occurs, and what if they expect crc status
to work due to this? I am not sure how far we should go with this.
also the paths have to be translated for WSL, currently after adding bash, zsh
to the supported shells list in https://github.com/crc-org/crc/blob/97705a008eda801ba291fe3b9982af464d4759e0/pkg/os/shell/shell_windows.go#L12
it gives us windows style paths:
annant@DESKTOP-J8H86J0:/mnt/c/Users/anath/go/bin$ ./crc.exe podman-env --shell bash
export PATH="C:\Users\anath\.crc\bin\oc:$PATH"
export CONTAINER_SSHKEY="C:\Users\anath\.crc\machines\crc\id_ecdsa"
export CONTAINER_HOST="ssh://core@172.28.208.1:2222/run/user/1000/podman/podman.sock"
export DOCKER_HOST="npipe:////./pipe/crc-podman"
# Run this command to configure your shell:
# eval $(crc podman-env)
General information
Currently when running
crc.exe podman-env
orcrc.exe oc-env
from a WSL terminal, it detects the shell ascmd
we can override the detection to force a specific shell with the
--shell
flag (currently it doesn't include bash, zsh, fish as supported shells for windows) but it'd be good to auto-detect without having to use the "force-shell" flag