-
Notifications
You must be signed in to change notification settings - Fork 431
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
[script]
annotation
#1479
Comments
I can easily see people writing a recipe with conflicting I don't understand the complexities of using (or maybe it's just implementing) the feature on Windows, but it's really appealing to me to have the language of the recipe content right next to the code itself. Is the current implementation on Windows something that will break? Just my £.02. |
@casey does some magic on Windows systems where you can have a shebang like recipe:
#!powershell.exe
Clear-Host
Write-Output "Hello from PowerShell" This is absolutely not acceptable shebang syntax on *nix systems. There the full path to the interpreter or whatever must be included. Unless you have some very special setup like @casey apparently does. 😉 This feature has been part of the Windows version of Just for forever. It will likely never break unless Windows itself does something "special". 😃 |
@casey The script syntax your suggesting is definitely cleaner than parsing the recipe to extract the shebang interpeter. But, I was thinking and testing this more after studying the code and wondered why the Unix make_shebang_command can't function more like the Windows make_shebang_command and invoke the shebang.interpreter instead of the script? The syntax |
It certainly could function like Windows, and this would fix some cross-platform inconsistencies on Unix OSs, for example, different OSs split shebang lines differently. I would be worried that there would be some change in behavior, so it wouldn't be backwards compatible, but that could be tested for. |
One example -
Currently, testing on Xubuntu 22.04, this will run a script Also not sure if/how |
The intent was to run whatever it found on I did miss that On macos, I did do a few tests with
On the current version the first two fail (as expected) and the last one succeeds. When using Window's shebang approach they all succeed (as expected) since It is closer to how a theoretical |
Coming over from #2253 I would love this change, especially with the |
This might have been plausible work around which works on Macos,
but fails on Windows because of the current Windows shebang argument handling. The argument passed to just.exe ends up being |
Just saw @runeimp's approach to this from #1549 (comment) which works. Not elegant, but way nicer then escaping multiline scripts to pretend they are one line. For
|
Sorry I wasn't clear. Was referring to this - https://just.systems/man/en/chapter_43.html#writing-recipes-in-other-languages
Not sure if/how |
Released in 1.32.0. |
Shebangs are not supported on all platforms, and a fair amount of hackery to get working. Including calling
cygpath
on windows if the path contains forward slashes. To work around this, we could add a[script]
annotation, which would take a command and arguments. When a[script]
recipe was executed, it would be passed as the final argument to the command.So this recipe:
Would be run like this recipe:
Eventually, we could add a
script-interpreter
setting, and allow the command to be omitted:The text was updated successfully, but these errors were encountered: