dundalek / closh

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

Subshell support #119

Open dundalek opened 5 years ago

dundalek commented 5 years ago

Example of subshell in bash:

(cd foo; ./run-some-program)

Possible alternative in closh:

(subsh cd foo \; ./run-some-program)

Another bash example (expecting to still be in the original dir when it's done):

(cd subdirectory && command --that might.fail) && run --command-in-original-dir --only-if-subshell-succeeded

I think that spawning another process would be inefficient. Maybe we could just spawn a thread. There are things that would need to be isolated/preserved:

It might be worth considering to do the isolation with boot pods.

There are other useful suggestions in https://github.com/fish-shell/fish-shell/issues/1439.