Replies: 2 comments
-
I can definitely see the value in this. This could take the form of a setting, which would provide a command for running recipes. When that setting was given, all recipes would be extracted and written to disk in the same way as shebang recipes, and run by passing the path to the extracted script to the command given in the setting:
Some open questions: Is this useful? What are the use cases? It's always good to understand what problems a feature is intended to solve, to make sure that there isn't a better way to solve those problems, and to make sure that the implemented feature actually solves those problems. Should the setting both switch all scripts to be interpreted, and give the interpreter command? You can imagine doing this with a separate setting:
Or with an attribute:
Also the name is up for bikeshedding:
set script-interpreter := ["sh", "-c"] [script]
|
Beta Was this translation helpful? Give feedback.
-
I think the oneshell concept is probably more about execution time than scriptability. If each line in a recipe is opened in its own shell then the launch time of the shell is part of the processing time for each line. For most things this is most likely insignificant. But for recipes that have many lines that run very fast applications (time measured in microseconds), then the launch time for each shell launch (measured in milliseconds at best) can be significant. Not to say scriptability isn't part of it. So I think having this as a setting would negate the need for many shebang scripts, it would also remove the shebang signature which gives major context into the expected execution of the recipe. |
Beta Was this translation helpful? Give feedback.
-
Make has the ONESHELL option, which changes the way all targets are executed.
Instead of executing each line in an isolated shell, it runs all of it in a single shell. I suppose it's equivalent to making all recipes be shebang recipes implicitly, by default, with whatever the configured
shell
is.I don't see "ONESHELL" being mentioned anywhere here, either on code or github issues/discussions. Is this idea worth considering?
Beta Was this translation helpful? Give feedback.
All reactions