dundalek / closh

Bash-like shell based on Clojure
Eclipse Public License 1.0
1.61k stars 65 forks source link

Glob expansion does not take directory change into consideration #98

Closed dundalek closed 5 years ago

dundalek commented 5 years ago

For example in closh source directory ls -d * gives:

appveyor.yml
bin
boot.properties
build.boot
CHANGELOG.md
closh.iml
deps.edn
doc
Dockerfile
LICENSE
node_modules
out
package.json
package-lock.json
README.md
scripts
src
target
test
yarn-error.log

Then switching to directory with cd src and ls -d * expands files of parent directory which results in this issue:

ls: cannot access 'closh.iml': No such file or directory
ls: cannot access 'target': No such file or directory
ls: cannot access 'doc': No such file or directory
ls: cannot access 'CHANGELOG.md': No such file or directory
ls: cannot access 'README.md': No such file or directory
ls: cannot access 'Dockerfile': No such file or directory
ls: cannot access 'package.json': No such file or directory
ls: cannot access 'build.boot': No such file or directory
ls: cannot access 'LICENSE': No such file or directory
ls: cannot access 'scripts': No such file or directory
ls: cannot access 'bin': No such file or directory
ls: cannot access 'yarn-error.log': No such file or directory
ls: cannot access 'boot.properties': No such file or directory
ls: cannot access 'deps.edn': No such file or directory
ls: cannot access 'package-lock.json': No such file or directory
ls: cannot access 'src': No such file or directory
ls: cannot access 'node_modules': No such file or directory
ls: cannot access 'test': No such file or directory
ls: cannot access 'out': No such file or directory
ls: cannot access 'appveyor.yml': No such file or directory

The fix will likely be in modifying how the clj-glob gets current working directory.