emacs-tree-sitter / elisp-tree-sitter

Emacs Lisp bindings for tree-sitter
https://emacs-tree-sitter.github.io
MIT License
815 stars 73 forks source link

bin/build not work on linux because builtin cd will output the folder name. #244

Open zw963 opened 1 year ago

zw963 commented 1 year ago
 ╰─ $ builtin cd bin
/home/zw963/bin

 ╭─ 02:05  zw963 ⮀ ~/bin ⮀ ➦   0 
 ╰─ $ cd ..

 ╭─ 02:06  zw963 ⮀ ~ ⮀ ➦   0 
 ╰─ $ \cd bin
/home/zw963/bin

So, this the following output will be:

here=$(cd "$(dirname "$BASH_SOURCE")"; pwd)

The here variable would output 2 line string, instead only 1 line.

 ╰─ $ bin/1.sh 
+++ dirname bin/1.sh
++ cd bin
++ pwd
+ here='/home/zw963/bin
/home/zw963/bin'

here is /home/zw963/bin /home/zw963/bin

so, it should be fix with:

here=$(cd "$(dirname "$BASH_SOURCE")" >/dev/null; pwd)

print the cd folder name probably is a shell config issue, but, anyway, new config more robust.

zw963 commented 1 year ago

BTW, this issue only happen when set $CDPATH