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

"oh-my-posh: command not found" when start Ubuntu-wsl with Windows Terminal #2298

Closed
1 task done
aldehyde-rcho opened this issue May 20, 2022 · 10 comments
Closed
1 task done
Assignees
Labels
🐛 bug Something isn't working

Comments

@aldehyde-rcho
Copy link

Code of Conduct

  • I agree to follow this project's Code of Conduct

What happened?

I want to apply oh-my-posh on wsl. With the doc I successfully installed it on Powershell and WSL.
But I found a question. When I start bash on Ubuntu with Windows Terminal, oh-my-posh seems not work immediately. I can run oh-my-posh by doing "exec bash" after starting the bash.
ScreenShot1
ScreenShot2
In the second picture, I can successly run Powershell with oh-my-posh, but after I started bash of Ubuntu by running "wsl", It seems something go wrong.
And I can successfully run bash with oh-my-posh in VSCode (when starting a new bash in VSCode).
ScreenShot3
I don't know what I can do. I tried to uninstall and install for another time.
I think this problem may related with the settings of starting wsl from Windows. But I have no idea how to fix it.

Thanks for help!

Theme

night-owl

What OS are you seeing the problem on?

Linux

Which shell are you using?

bash

Log output

Version: 7.86.0

Segments:

ConsoleTitle(true)   -   0 ms - ~
os(true)             -   0 ms - ╭─ WSL at   
root(false)          -   0 ms -
path(true)           -   2 ms -    
git(false)           -   0 ms -
executiontime(true)  -   0 ms -  0ms 
shell(true)          -   0 ms -  bash
sysinfo(true)        -   1 ms -   3.81% 
node(false)          -   0 ms -
python(false)        -   1 ms -
java(false)          -   0 ms -
php(false)           -   0 ms -
dotnet(false)        -   0 ms -
go(false)            -   0 ms -
rust(false)          -   0 ms -
dart(false)          -   0 ms -
angular(false)       -   0 ms -
julia(false)         -   0 ms -
ruby(false)          -   0 ms -
azfunc(false)        -   0 ms -
aws(false)           -   0 ms -
kubectl(false)       -  36 ms -
time(true)           -   0 ms -   01:32:46 
text(true)           -   0 ms - ╰─
spotify(false)       - 120 ms -
exit(true)           -   0 ms - 

Run duration: 167.860023ms

Cache path: /home/aldehyde2004/.cache/oh-my-posh

Config path: /home/aldehyde2004/.oh-my-posh-themes/night-owl.omp.json

Logs:

2022/05/21 01:32:46 debug: Getenv

2022/05/21 01:32:46 Getenv duration: 11.082µs, args: XDG_CACHE_HOME
2022/05/21 01:32:46 CachePath duration: 22.623µs, args:
2022/05/21 01:32:46 debug: Getenv
/home/aldehyde2004/.oh-my-posh-themes/night-owl.omp.json
2022/05/21 01:32:46 Getenv duration: 5.521µs, args: POSH_THEME
2022/05/21 01:32:46 resolveConfigPath duration: 7.885µs, args:
2022/05/21 01:32:46 Init duration: 64.924µs, args:
2022/05/21 01:32:46 Flags duration: 60ns, args:
2022/05/21 01:32:46 config.loadConfig duration: 948.451µs, args:
2022/05/21 01:32:46 Flags duration: 40ns, args:
2022/05/21 01:32:46 debug: Getenv

2022/05/21 01:32:46 Getenv duration: 1.072µs, args: OMP_CACHE_DISABLED
2022/05/21 01:32:46 Root duration: 461ns, args:
2022/05/21 01:32:46 Shell duration: 430.933µs, args:
2022/05/21 01:32:46 ErrorCode duration: 40ns, args:
2022/05/21 01:32:46 debug: Getenv
Ubuntu
2022/05/21 01:32:46 Getenv duration: 2.405µs, args: WSL_DISTRO_NAME
2022/05/21 01:32:46 IsWsl duration: 4.469µs, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 8.796µs, args:
2022/05/21 01:32:46 PathSeparator duration: 81ns, args:
2022/05/21 01:32:46 PathSeparator duration: 30ns, args:
2022/05/21 01:32:46 debug: User
aldehyde2004
2022/05/21 01:32:46 User duration: 892ns, args:
2022/05/21 01:32:46 debug: Host
Xiaoxin
2022/05/21 01:32:46 Host duration: 1.573µs, args:
2022/05/21 01:32:46 GOOS duration: 41ns, args:
2022/05/21 01:32:46 TemplateCache duration: 492.38µs, args:
2022/05/21 01:32:46 Flags duration: 30ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 1.123µs, args:
2022/05/21 01:32:46 GOOS duration: 30ns, args:
2022/05/21 01:32:46 GOOS duration: 20ns, args:
2022/05/21 01:32:46 TemplateCache duration: 91ns, args:
2022/05/21 01:32:46 TemplateCache duration: 271ns, args:
2022/05/21 01:32:46 Shell duration: 170ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 2.746µs, args:
2022/05/21 01:32:46 GOOS duration: 40ns, args:
2022/05/21 01:32:46 Root duration: 1.282µs, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 1.052µs, args:
2022/05/21 01:32:46 GOOS duration: 20ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 632ns, args:
2022/05/21 01:32:46 Flags duration: 80ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 641ns, args:
2022/05/21 01:32:46 GOOS duration: 30ns, args:
2022/05/21 01:32:46 GOOS duration: 20ns, args:
2022/05/21 01:32:46 Flags duration: 30ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 661ns, args:
2022/05/21 01:32:46 GOOS duration: 30ns, args:
2022/05/21 01:32:46 GOOS duration: 20ns, args:
2022/05/21 01:32:46 PathSeparator duration: 40ns, args:
2022/05/21 01:32:46 PathSeparator duration: 20ns, args:
2022/05/21 01:32:46 PathSeparator duration: 30ns, args:
2022/05/21 01:32:46 PathSeparator duration: 30ns, args:
2022/05/21 01:32:46 GOOS duration: 20ns, args:
2022/05/21 01:32:46 debug: Getenv
Ubuntu
2022/05/21 01:32:46 Getenv duration: 1.523µs, args: WSL_DISTRO_NAME
2022/05/21 01:32:46 IsWsl duration: 3.827µs, args:
2022/05/21 01:32:46 debug: RunCommand
//wsl.localhost/Ubuntu/home/aldehyde2004
2022/05/21 01:32:46 RunCommand duration: 1.829383ms, args: wslpath -m /home/aldehyde2004
2022/05/21 01:32:46 StackCount duration: 50ns, args:
2022/05/21 01:32:46 DirIsWritable duration: 12.314µs, args:
2022/05/21 01:32:46 TemplateCache duration: 50ns, args:
2022/05/21 01:32:46 TemplateCache duration: 140ns, args:
2022/05/21 01:32:46 Shell duration: 81ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 1.172µs, args:
2022/05/21 01:32:46 GOOS duration: 31ns, args:
2022/05/21 01:32:46 debug: Getenv
Ubuntu
2022/05/21 01:32:46 Getenv duration: 902ns, args: WSL_DISTRO_NAME
2022/05/21 01:32:46 IsWsl duration: 2.244µs, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 6.352µs, args:
2022/05/21 01:32:46 GOOS duration: 20ns, args:
2022/05/21 01:32:46 HasCommand duration: 10.41µs, args: git
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 702ns, args:
2022/05/21 01:32:46 error: HasParentFilePath
stat /.git: no such file or directory
2022/05/21 01:32:46 HasParentFilePath duration: 6.132µs, args: .git
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 761ns, args:
2022/05/21 01:32:46 GOOS duration: 20ns, args:
2022/05/21 01:32:46 ExecutionTime duration: 70ns, args:
2022/05/21 01:32:46 TemplateCache duration: 40ns, args:
2022/05/21 01:32:46 TemplateCache duration: 140ns, args:
2022/05/21 01:32:46 Shell duration: 50ns, args:
2022/05/21 01:32:46 Flags duration: 30ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 982ns, args:
2022/05/21 01:32:46 GOOS duration: 40ns, args:
2022/05/21 01:32:46 Shell duration: 20ns, args:
2022/05/21 01:32:46 Flags duration: 30ns, args:
2022/05/21 01:32:46 TemplateCache duration: 40ns, args:
2022/05/21 01:32:46 TemplateCache duration: 140ns, args:
2022/05/21 01:32:46 Shell duration: 60ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 10.871µs, args:
2022/05/21 01:32:46 GOOS duration: 40ns, args:
2022/05/21 01:32:46 TemplateCache duration: 140ns, args:
2022/05/21 01:32:46 TemplateCache duration: 130ns, args:
2022/05/21 01:32:46 Shell duration: 210ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 1.734µs, args:
2022/05/21 01:32:46 GOOS duration: 70ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 782ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 13.606µs, args:
2022/05/21 01:32:46 GOOS duration: 71ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 1.713µs, args:
2022/05/21 01:32:46 debug: Getenv

2022/05/21 01:32:46 Getenv duration: 1.864µs, args: VIRTUAL_ENV
2022/05/21 01:32:46 debug: Getenv

2022/05/21 01:32:46 Getenv duration: 1.764µs, args: CONDA_ENV_PATH
2022/05/21 01:32:46 debug: Getenv

2022/05/21 01:32:46 Getenv duration: 1.553µs, args: CONDA_DEFAULT_ENV
2022/05/21 01:32:46 debug: Getenv

2022/05/21 01:32:46 Getenv duration: 6.793µs, args: JAVA_HOME
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 1.393µs, args:
2022/05/21 01:32:46 GOOS duration: 40ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 1.232µs, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 1.252µs, args:
2022/05/21 01:32:46 GOOS duration: 41ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 3.867µs, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 3.146µs, args:
2022/05/21 01:32:46 GOOS duration: 40ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 5.561µs, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 6.392µs, args:
2022/05/21 01:32:46 GOOS duration: 40ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 2.595µs, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 1.082µs, args:
2022/05/21 01:32:46 GOOS duration: 30ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 891ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 942ns, args:
2022/05/21 01:32:46 GOOS duration: 20ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 812ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 2.244µs, args:
2022/05/21 01:32:46 GOOS duration: 20ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 821ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 912ns, args:
2022/05/21 01:32:46 GOOS duration: 30ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 882ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 942ns, args:
2022/05/21 01:32:46 GOOS duration: 20ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 872ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 1.032µs, args:
2022/05/21 01:32:46 GOOS duration: 20ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 852ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 1.423µs, args:
2022/05/21 01:32:46 GOOS duration: 30ns, args:
2022/05/21 01:32:46 debug: Getenv

2022/05/21 01:32:46 Getenv duration: 2.695µs, args: AWS_VAULT
2022/05/21 01:32:46 debug: Getenv

2022/05/21 01:32:46 Getenv duration: 1.022µs, args: AWS_PROFILE
2022/05/21 01:32:46 debug: Getenv

2022/05/21 01:32:46 Getenv duration: 2.715µs, args: AWS_REGION
2022/05/21 01:32:46 debug: Getenv

2022/05/21 01:32:46 Getenv duration: 15.079µs, args: AWS_DEFAULT_REGION
2022/05/21 01:32:46 debug: Getenv

2022/05/21 01:32:46 Getenv duration: 5.059µs, args: AWS_CONFIG_FILE
2022/05/21 01:32:46 error: FileContent
open /home/aldehyde2004/.aws/config: no such file or directory
2022/05/21 01:32:46 FileContent duration: 20.809µs, args: /home/aldehyde2004/.aws/config
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 2.715µs, args:
2022/05/21 01:32:46 GOOS duration: 80ns, args:
2022/05/21 01:32:46 error: CommandPath
not relevant
2022/05/21 01:32:46 HasCommand duration: 36.635253ms, args: kubectl
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 1.623µs, args:
2022/05/21 01:32:46 GOOS duration: 50ns, args:
2022/05/21 01:32:46 TemplateCache duration: 150ns, args:
2022/05/21 01:32:46 TemplateCache duration: 160ns, args:
2022/05/21 01:32:46 Shell duration: 120ns, args:
2022/05/21 01:32:46 Flags duration: 60ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 1.212µs, args:
2022/05/21 01:32:46 GOOS duration: 40ns, args:
2022/05/21 01:32:46 TemplateCache duration: 20ns, args:
2022/05/21 01:32:46 TemplateCache duration: 100ns, args:
2022/05/21 01:32:46 Shell duration: 50ns, args:
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 1.142µs, args:
2022/05/21 01:32:46 GOOS duration: 41ns, args:
2022/05/21 01:32:46 debug: Getenv
Ubuntu
2022/05/21 01:32:46 Getenv duration: 1.072µs, args: WSL_DISTRO_NAME
2022/05/21 01:32:46 IsWsl duration: 2.765µs, args:
2022/05/21 01:32:46 debug: RunCommand
INFO: No tasks are running which match the specified criteria.
2022/05/21 01:32:46 RunCommand duration: 120.511724ms, args: tasklist.exe /V /FI Imagename eq Spotify.exe /FO CSV /NH
2022/05/21 01:32:46 debug: Pwd
/home/aldehyde2004
2022/05/21 01:32:46 Pwd duration: 1.353µs, args:
2022/05/21 01:32:46 GOOS duration: 40ns, args:
2022/05/21 01:32:46 ErrorCode duration: 111ns, args:
2022/05/21 01:32:46 TemplateCache duration: 190ns, args:
2022/05/21 01:32:46 TemplateCache duration: 50ns, args:
2022/05/21 01:32:46 Shell duration: 120ns, args:
2022/05/21 01:32:46 TemplateCache duration: 90ns, args:
2022/05/21 01:32:46 debug: Getenv

2022/05/21 01:32:46 Getenv duration: 1.553µs, args: XDG_CACHE_HOME
2022/05/21 01:32:46 CachePath duration: 14.709µs, args:
2022/05/21 01:32:46 Flags duration: 40ns, args:
╭─ WSL at       179ms                                                          bash  3.81%   01:32:46 
╰─
@aldehyde-rcho aldehyde-rcho added the 🐛 bug Something isn't working label May 20, 2022
@ehawman-rosenberg
Copy link
Contributor

ehawman-rosenberg commented May 20, 2022

@aldehyde-rcho What are the contents of ~/.bashrc?

@JanDeDobbeleer
Copy link
Owner

@aldehyde-rcho this implies that oh-my-posh isn't in your PATH. If you installed with homebrew on Linux, did you see the remark on how to add homebrew to your PATH?

Note
Follow the Next steps instructions to add Homebrew to your PATH and to your bash shell profile script, either ~/.profile on Debian/Ubuntu or ~/.bash_profile on CentOS/Fedora/Red Hat.

test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bash_profile
echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.profile

@lewis-yeung
Copy link
Contributor

See #2123 and maybe it helps with solving the PATH problem.

之前遇到过一个问题:有些系统默认在 ~/.profile 中设置了检测逻辑,若当前运行的 shell 为 bash,则引入 ~/.bashrc,不论其是否为 login shell。在这个前提下,如果 OMP 初始化命令写在 ~/.bashrc 中,而将 OMP 所在目录加入 PATH 的命令写在 ~/.profile 末尾,则会因执行顺序不当导致报错。

@aldehyde-rcho
Copy link
Author

Thanks so much.
I changed the ~./profile and put the line eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" before

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

and now the initialization problem seems solved.. but I found another problem here:

Screenshot1

I changed to another theme "microverse-power" and it looks like this:

Screenshot2

Now I have this in ~/.profile

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

and this in the last line of ~/.bashrc

eval "$(oh-my-posh init bash --config ./.oh-my-posh-themes/night-owl.omp.json)"

the output of oh-my-posh debug:

╭─ WSL at       0ms                                                            bash  7.72%   12:08:43 
╰─ oh-my-posh debug

Version: 7.86.0

Segments:

ConsoleTitle(true)   -   0 ms - ~
os(true)             -   0 ms - ╭─ WSL at   
root(false)          -   0 ms -
path(true)           -   2 ms -    
git(false)           -   0 ms -
executiontime(true)  -   0 ms -  0ms 
shell(true)          -   0 ms -  bash
sysinfo(true)        -   3 ms -   7.61% 
node(false)          -   0 ms -
python(false)        -   0 ms -
java(false)          -   0 ms -
php(false)           -   0 ms -
dotnet(false)        -   0 ms -
go(false)            -   0 ms -
rust(false)          -   0 ms -
dart(false)          -   0 ms -
angular(false)       -   0 ms -
julia(false)         -   0 ms -
ruby(false)          -   0 ms -
azfunc(false)        -   0 ms -
aws(false)           -   0 ms -
kubectl(false)       -  27 ms -
time(true)           -   0 ms -   12:08:56 
text(true)           -   0 ms - ╰─
spotify(false)       - 119 ms -
exit(true)           -   0 ms - 

Run duration: 156.715233ms

Cache path: /home/aldehyde2004/.cache/oh-my-posh

Config path: /home/aldehyde2004/.oh-my-posh-themes/night-owl.omp.json

Logs:

2022/05/21 12:08:56 debug: Getenv

2022/05/21 12:08:56 Getenv duration: 7.945µs, args: XDG_CACHE_HOME
2022/05/21 12:08:56 CachePath duration: 19.988µs, args:
2022/05/21 12:08:56 debug: Getenv
/home/aldehyde2004/.oh-my-posh-themes/night-owl.omp.json
2022/05/21 12:08:56 Getenv duration: 7.694µs, args: POSH_THEME
2022/05/21 12:08:56 resolveConfigPath duration: 9.869µs, args:
2022/05/21 12:08:56 Init duration: 66.618µs, args:
2022/05/21 12:08:56 Flags duration: 40ns, args:
2022/05/21 12:08:56 config.loadConfig duration: 1.001662ms, args:
2022/05/21 12:08:56 Flags duration: 210ns, args:
2022/05/21 12:08:56 debug: Getenv

2022/05/21 12:08:56 Getenv duration: 1.563µs, args: OMP_CACHE_DISABLED
2022/05/21 12:08:56 Root duration: 441ns, args:
2022/05/21 12:08:56 Shell duration: 419.902µs, args:
2022/05/21 12:08:56 ErrorCode duration: 40ns, args:
2022/05/21 12:08:56 debug: Getenv
Ubuntu
2022/05/21 12:08:56 Getenv duration: 1.342µs, args: WSL_DISTRO_NAME
2022/05/21 12:08:56 IsWsl duration: 2.896µs, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 9.458µs, args:
2022/05/21 12:08:56 PathSeparator duration: 50ns, args:
2022/05/21 12:08:56 PathSeparator duration: 30ns, args:
2022/05/21 12:08:56 debug: User
aldehyde2004
2022/05/21 12:08:56 User duration: 991ns, args:
2022/05/21 12:08:56 debug: Host
Xiaoxin
2022/05/21 12:08:56 Host duration: 1.473µs, args:
2022/05/21 12:08:56 GOOS duration: 40ns, args:
2022/05/21 12:08:56 TemplateCache duration: 468.764µs, args:
2022/05/21 12:08:56 Flags duration: 40ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 932ns, args:
2022/05/21 12:08:56 GOOS duration: 20ns, args:
2022/05/21 12:08:56 GOOS duration: 20ns, args:
2022/05/21 12:08:56 TemplateCache duration: 60ns, args:
2022/05/21 12:08:56 TemplateCache duration: 140ns, args:
2022/05/21 12:08:56 Shell duration: 50ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 1.212µs, args:
2022/05/21 12:08:56 GOOS duration: 41ns, args:
2022/05/21 12:08:56 Root duration: 240ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 822ns, args:
2022/05/21 12:08:56 GOOS duration: 20ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 731ns, args:
2022/05/21 12:08:56 Flags duration: 40ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 671ns, args:
2022/05/21 12:08:56 GOOS duration: 30ns, args:
2022/05/21 12:08:56 GOOS duration: 20ns, args:
2022/05/21 12:08:56 Flags duration: 20ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 4.809µs, args:
2022/05/21 12:08:56 GOOS duration: 20ns, args:
2022/05/21 12:08:56 GOOS duration: 30ns, args:
2022/05/21 12:08:56 PathSeparator duration: 40ns, args:
2022/05/21 12:08:56 PathSeparator duration: 30ns, args:
2022/05/21 12:08:56 PathSeparator duration: 30ns, args:
2022/05/21 12:08:56 PathSeparator duration: 30ns, args:
2022/05/21 12:08:56 GOOS duration: 21ns, args:
2022/05/21 12:08:56 debug: Getenv
Ubuntu
2022/05/21 12:08:56 Getenv duration: 852ns, args: WSL_DISTRO_NAME
2022/05/21 12:08:56 IsWsl duration: 2.124µs, args:
2022/05/21 12:08:56 debug: RunCommand
//wsl.localhost/Ubuntu/home/aldehyde2004
2022/05/21 12:08:56 RunCommand duration: 2.362408ms, args: wslpath -m /home/aldehyde2004
2022/05/21 12:08:56 StackCount duration: 111ns, args:
2022/05/21 12:08:56 DirIsWritable duration: 10.961µs, args:
2022/05/21 12:08:56 TemplateCache duration: 180ns, args:
2022/05/21 12:08:56 TemplateCache duration: 141ns, args:
2022/05/21 12:08:56 Shell duration: 120ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 1.132µs, args:
2022/05/21 12:08:56 GOOS duration: 40ns, args:
2022/05/21 12:08:56 debug: Getenv
Ubuntu
2022/05/21 12:08:56 Getenv duration: 1.202µs, args: WSL_DISTRO_NAME
2022/05/21 12:08:56 IsWsl duration: 2.585µs, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 1.753µs, args:
2022/05/21 12:08:56 GOOS duration: 30ns, args:
2022/05/21 12:08:56 HasCommand duration: 14.137µs, args: git
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 682ns, args:
2022/05/21 12:08:56 error: HasParentFilePath
stat /.git: no such file or directory
2022/05/21 12:08:56 HasParentFilePath duration: 6.563µs, args: .git
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 792ns, args:
2022/05/21 12:08:56 GOOS duration: 20ns, args:
2022/05/21 12:08:56 ExecutionTime duration: 50ns, args:
2022/05/21 12:08:56 TemplateCache duration: 40ns, args:
2022/05/21 12:08:56 TemplateCache duration: 111ns, args:
2022/05/21 12:08:56 Shell duration: 70ns, args:
2022/05/21 12:08:56 Flags duration: 40ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 972ns, args:
2022/05/21 12:08:56 GOOS duration: 30ns, args:
2022/05/21 12:08:56 Shell duration: 30ns, args:
2022/05/21 12:08:56 Flags duration: 20ns, args:
2022/05/21 12:08:56 TemplateCache duration: 20ns, args:
2022/05/21 12:08:56 TemplateCache duration: 110ns, args:
2022/05/21 12:08:56 Shell duration: 60ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 4.228µs, args:
2022/05/21 12:08:56 GOOS duration: 30ns, args:
2022/05/21 12:08:56 TemplateCache duration: 50ns, args:
2022/05/21 12:08:56 TemplateCache duration: 351ns, args:
2022/05/21 12:08:56 Shell duration: 120ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 1.984µs, args:
2022/05/21 12:08:56 GOOS duration: 40ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 692ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 841ns, args:
2022/05/21 12:08:56 GOOS duration: 30ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 752ns, args:
2022/05/21 12:08:56 debug: Getenv

2022/05/21 12:08:56 Getenv duration: 912ns, args: VIRTUAL_ENV
2022/05/21 12:08:56 debug: Getenv

2022/05/21 12:08:56 Getenv duration: 801ns, args: CONDA_ENV_PATH
2022/05/21 12:08:56 debug: Getenv

2022/05/21 12:08:56 Getenv duration: 751ns, args: CONDA_DEFAULT_ENV
2022/05/21 12:08:56 debug: Getenv

2022/05/21 12:08:56 Getenv duration: 852ns, args: JAVA_HOME
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 721ns, args:
2022/05/21 12:08:56 GOOS duration: 20ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 751ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 812ns, args:
2022/05/21 12:08:56 GOOS duration: 20ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 742ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 792ns, args:
2022/05/21 12:08:56 GOOS duration: 20ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 661ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 812ns, args:
2022/05/21 12:08:56 GOOS duration: 20ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 691ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 781ns, args:
2022/05/21 12:08:56 GOOS duration: 20ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 671ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 761ns, args:
2022/05/21 12:08:56 GOOS duration: 30ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 681ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 751ns, args:
2022/05/21 12:08:56 GOOS duration: 30ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 761ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 751ns, args:
2022/05/21 12:08:56 GOOS duration: 20ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 751ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 801ns, args:
2022/05/21 12:08:56 GOOS duration: 20ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 701ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 801ns, args:
2022/05/21 12:08:56 GOOS duration: 30ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 671ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 741ns, args:
2022/05/21 12:08:56 GOOS duration: 20ns, args:
2022/05/21 12:08:56 debug: Getenv

2022/05/21 12:08:56 Getenv duration: 772ns, args: AWS_VAULT
2022/05/21 12:08:56 debug: Getenv

2022/05/21 12:08:56 Getenv duration: 791ns, args: AWS_PROFILE
2022/05/21 12:08:56 debug: Getenv

2022/05/21 12:08:56 Getenv duration: 772ns, args: AWS_REGION
2022/05/21 12:08:56 debug: Getenv

2022/05/21 12:08:56 Getenv duration: 761ns, args: AWS_DEFAULT_REGION
2022/05/21 12:08:56 debug: Getenv

2022/05/21 12:08:56 Getenv duration: 802ns, args: AWS_CONFIG_FILE
2022/05/21 12:08:56 error: FileContent
open /home/aldehyde2004/.aws/config: no such file or directory
2022/05/21 12:08:56 FileContent duration: 11.592µs, args: /home/aldehyde2004/.aws/config
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 992ns, args:
2022/05/21 12:08:56 GOOS duration: 30ns, args:
2022/05/21 12:08:56 error: CommandPath
not relevant
2022/05/21 12:08:56 HasCommand duration: 27.276642ms, args: kubectl
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 1.413µs, args:
2022/05/21 12:08:56 GOOS duration: 40ns, args:
2022/05/21 12:08:56 TemplateCache duration: 111ns, args:
2022/05/21 12:08:56 TemplateCache duration: 411ns, args:
2022/05/21 12:08:56 Shell duration: 130ns, args:
2022/05/21 12:08:56 Flags duration: 231ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 1.162µs, args:
2022/05/21 12:08:56 GOOS duration: 40ns, args:
2022/05/21 12:08:56 TemplateCache duration: 30ns, args:
2022/05/21 12:08:56 TemplateCache duration: 120ns, args:
2022/05/21 12:08:56 Shell duration: 40ns, args:
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 1.273µs, args:
2022/05/21 12:08:56 GOOS duration: 40ns, args:
2022/05/21 12:08:56 debug: Getenv
Ubuntu
2022/05/21 12:08:56 Getenv duration: 1.283µs, args: WSL_DISTRO_NAME
2022/05/21 12:08:56 IsWsl duration: 3.867µs, args:
2022/05/21 12:08:56 debug: RunCommand
INFO: No tasks are running which match the specified criteria.
2022/05/21 12:08:56 RunCommand duration: 119.512496ms, args: tasklist.exe /V /FI Imagename eq Spotify.exe /FO CSV /NH
2022/05/21 12:08:56 debug: Pwd
/home/aldehyde2004
2022/05/21 12:08:56 Pwd duration: 1.353µs, args:
2022/05/21 12:08:56 GOOS duration: 30ns, args:
2022/05/21 12:08:56 ErrorCode duration: 110ns, args:
2022/05/21 12:08:56 TemplateCache duration: 241ns, args:
2022/05/21 12:08:56 TemplateCache duration: 110ns, args:
2022/05/21 12:08:56 Shell duration: 130ns, args:
2022/05/21 12:08:56 TemplateCache duration: 60ns, args:
2022/05/21 12:08:56 debug: Getenv

2022/05/21 12:08:56 Getenv duration: 3.096µs, args: XDG_CACHE_HOME
2022/05/21 12:08:56 CachePath duration: 16.221µs, args:
2022/05/21 12:08:56 Flags duration: 40ns, args:
╭─ WSL at       166ms                                                          bash  7.64%   12:08:56 
╰─

@JanDeDobbeleer
Copy link
Owner

@aldehyde-rcho that's a Windows Terminal bug.

@lewis-yeung
Copy link
Contributor

@aldehyde-rcho See #1029.

@ylli2000
Copy link

ylli2000 commented May 21, 2022

Maybe you can try this and see if it works?

.bashrc file:
eval "$(oh-my-posh --init --shell bash --config .your-oh-my-posh-theme.omp.json)"
clear # a dirty trick to clear the screen and temporarily fix the wt bug

@Max-Clixflow
Copy link

The solution for the theme bug.
write this at the end of .bashrc file:
eval "$(oh-my-posh init bash --config $(brew --prefix oh-my-posh)/themes/(--YOUR-BEST-THEME--).omp.json)"

Replace the "(--YOUR-BEST-THEME--)" with "jandedobbeleer" for example.

@mrcleanandfresh
Copy link

mrcleanandfresh commented Dec 6, 2023

My solution was very similar to @aldehyde-rcho's solution, except I'm using linuxbrew to install oh-my-posh. I noticed linuxbrew just appended its PATH set up to the end of my .profile, but my .bashrc was being sourced before the PATH was evaluated. So for me, it came down to a timing issue with my PATH:

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc" #<--- This is where my theme is initialized for oh-my-posh.
    fi
fi

#... truncated

# Set PATH, MANPATH, etc., for Homebrew.
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" #<---  this line sets up the path, where I installed oh-my-posh

So based on @aldehyde-rcho's solution, I moved things around:

# Set PATH, MANPATH, etc., for Homebrew.
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

#... truncated

Now it works fine for me.

Copy link

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues.
If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants