wvbe/fark

Fark doesn't recognize ZSH aliases

Closed this issue · 1 comments

wvbe commented

A colleague noticed that fark does not use the alias defined in .zshrc.

To reproduce:

  • Use ZSH or oh-my-zsh and edit the .zshrc file to uncomment the line that says # alias ohmyzsh="mate ~/.oh-my-zsh"
  • Open a terminal and execute ohmyzsh. Either the mate application starts, or the terminal tells you that mate is not recognized, but both mean that the alias works.
  • Go to a folder with some subfolders, and execute fark -$ ohmyzsh

Expected:

  • The same result that youve seen in the 2nd reproduction step, for every folder

Observed:

  • fark errors out on destructuring input from undefined
  • ... Caused by a promise rejection now being handled appropriately
  • The promise is rejected due to spawn ohmyzsh ENOENT, for every subfolder.

As another observation, on my machine it does look like the ZSH shell is being used;

echo $SHELL
fark -$ echo $SHELL
/usr/bin/zsh
wvbe commented

I've found that the .zshrc in which these aliases are defined is picked up normally. Environment variables are the same, and env variables defined in that file are the same too. I think the problem has to do with the way ZSH interprets your input before it is even passed to the executable -- possibly the ohmyzsh alias is immediately replaced with what it is aliasing, and ZSH is not doing this when passing -$ ohmyzsh to fark.

As a fix, make your ZSH aliases "global". Instead of alias foo="bar" in your .zshrc, use the -g flag;

alias -g foo="bar"

More on aliases in ZSH