Skip to content

Does JUST execute all scripts in a sub-shell? #1461

Answered by casey
shotexa asked this question in Q&A
Discussion options

You must be logged in to vote

That's correct. Each line of a recipe is, by default, executed in a new subshell. You can make just execute the whole recipe as a script, using a shebang, but that doesn't solve your problem.

Just is a child process of your interactive shell, and it has no way of forcing the parent shell to reload its configuration.

It isn't pretty, but one workaround would be to execute your shell recursively:

@cs-change-java:
	cs java --jvm $(cs java --installed | fzf | cut -d ' ' -f1) --setup  # this command modifies .zprofile, which sets JAVA_HOME
	zsh

Or run it on the command line like this:

just cs-change-java && exec zsh

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by shotexa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants