-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider ability to reload .env files between recipes #1011
Comments
Would it be better if there was some way to modify variables without modifying the |
Thanks for quick reply. I would like to be able to run the recipes one by one, which works now, but also together. I need the persistence to keep an execution ID around. Can it be done without modifying the |
I see, so persistence is a part of it. You could do something like this:
You would have to run Does that work? |
Not really. The solution works same way as an env file - it works if recipes are invoked separately, but breaks when invoked in a single run:
$ touch .time
$ just dep
echo $(date +%s) > .time
cat .time
1635542204
echo
$ just dep
echo $(date +%s) > .time
cat .time
1635542212
echo 1635542204
1635542204 What I really want is to generate and pass a persistent variable that works on separate recipes and on a chain. |
Yeah, that's tough. I can't think of a great way to do this, but I'll leave the issue open in case anyone thinks of something clever. |
So you want the ID to be generated in a recipe, and then use it in other recipes, right? This ID should be consistent throughout the current execution. Your question is really about inter-process communication and information sharing. The easiest way to do this is to use shared temporary files.
As in the case above, you can use something like @casey Also, may I ask if you think the The next step is to see if we can get just to establish a two-way connection between third-party (shell) programs instead of the current one-way execution. One way to do this is to open a new file descriptor (e.g. printf 'var := "value-from-init-recipe";' >&63 Gives the program in the recipe the opportunity to modify variables in the just process and even perform other Also need to implement a similar named pipe approach on Windows. In addition to file descriptor anonymous pipes, there are also named pipes, sockets, and other forms of communication. Just make sure it's cross-platform, lightweight, and performs well. |
That's a really interesting idea. Would that work on Windows? Is it possible to open a file descriptor by number without opening Another possibility is some kind of line annotation that would tell just that the output of that line was a directive, that just should parse and execute:
Scoping is pretty confusing, for example, in the following justfile,
I opened up other issues to discuss the functions you mentioned, those seem like good ideas. |
Yes, Windows support for inter-process communication is complete and covers anonymous pipes as well. PowerShell also has full access to dot net functions.
As far as I know macOS has full support and can be created and used without problems.
No, since there is already just, then just will act as both server and client. At startup, a unix socket or tcp socket is opened, and the listening socket address is passed to recipes via an environment variable. When executing the client Think of just as a simple in-memory key-value storage service. recipes would be able to share information among themselves, however, I think this is a complete over kill. Yet it is also the easiest to implement and the most stable way.
In fact, each line in recipes is a separate process. The core is still inter-process communication. Written this way, I don't see how just can get the data it wants to return from the child processes. If you don't open a new file descriptor, it already takes up stdout and stderr. If you do implement a socket, then you are actually turning just into a tool with network capabilities. It has daemon server mode. You can connect via For example, you have 3 steps of recipes that are executed by 3 different remote servers in distributed parallel, and after execution, the variable data or even the file is sent back, and then the local steps continue. |
Maybe there is a better way, but I would like to modify the
.env
file from within a recipe and use it afterwards.The only working solution I found was following:
Ideally there would be a flag to auto reload .env files between recipes. Right now they are read at startup and even calling
just
recursively does not work as the old environment variables will have precedence before the .env file.The text was updated successfully, but these errors were encountered: