-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow multiple lines of hashbangs #715
Comments
@fmnxl (also cc @rockofox), and anyone interested: this issue keeps bugging me, probably for the same reason as you, As I managed to find a different not-as-portable approach to overcome this limitation (which makes it a single shebang line), I'm sharing it here.
If you can live with those two requirements, this is the shebang line:
Please let me know if this works for you, and if you manage to find a way to simplify this. (given the current files-without-extension temporary files behavior, I advise you to still use the |
Actually shbang supported via node. Zx not handles shbang. |
@antonmedv I guess the reasoning behind this issue being a feature request was because it was possible for @fmnxl @rockofox I just accidentally discovered that As such, @antonmedv, I believe this issue can be closed because, as in the unofficial NixOS wiki Lua example, we can resort to JavaScript's block comments ("multi-line") to make this work with #! /usr/bin/env nix-shell
/*
#! nix-shell -i zx -p zx
*/
$.verbose = true;
await Promise.all([
$`sleep 1; echo 1`,
$`sleep 2; echo 2`,
$`sleep 3; echo 3`,
]); |
Should we add some notes about this behavior to documentation? A nix-guide of docs website? @jlbribeiro maybe you can write a short .md file? |
Expected Behavior
Nix allows the use of shebang to define a custom interpreter, for example:
zx should ignore multiple shebang lines instead only the first one.
Actual Behavior
SyntaxError: Invalid or unexpected token
Steps to Reproduce the Problem
zx script.mjs
Specifications
The text was updated successfully, but these errors were encountered: