dundalek / closh

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

`cd` doesn't change directory #144

Closed naclander closed 5 years ago

naclander commented 5 years ago

I am running the release JVM binary under Linux and using the cd command doesn't actually seem to be changing directories.

Digging a little deeper it seems that https://github.com/dundalek/closh/blob/master/src/jvm/closh/zero/platform/process.clj#L30 doesn't actually permanently change the user.dir value.

PlumpMath commented 5 years ago

me too~*;

eggsyntax commented 5 years ago

Same here, also JVM binary + Linux.

naclander commented 5 years ago

I was also doing some reading about user.dir, I'm still not familiar with the inner workings of closh, but would a global variable that represents the cwd work, instead of saving it in user.dir?

dundalek commented 5 years ago

Sorry for the delayed response, I was on a vacation and then was busy with other work. That is strange, I run Linux and cd works for me. I am running Java 8, what version are you running?

I believe user.dir is also used when spawning processes or IO, but if it is causing trouble we might wanna change it to keep cwd explicitly. More issues around CWD are appearing, I will try to get a deeper look on a weekend.

I just tried it under Java 11 to confirm it and indeed cd does not work anymore.

eggsyntax commented 5 years ago

Java 11 for me. Thanks for taking a look!

dundalek commented 5 years ago

Fixed in master.

There are couple of small items I would like to tackle before I will push a release. In the meantime you can use manual build.

Interesting background on how this issue came to be: https://bugs.openjdk.java.net/browse/JDK-8194154 https://bugs.openjdk.java.net/browse/JDK-8202127

naclander commented 4 years ago

@dundalek Thanks! Looks like that fixed the issue for me.