-
Notifications
You must be signed in to change notification settings - Fork 40
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
[FEATURE] drop env's -S flag #54
Comments
Just leaving a comment for visibility. Any chance this is going to be merged soon? |
I just tripped over this too, thanks for describing it here! Until this is merged which workarounds do you use? I currently consider writing some additional scripts which then run the actual scripts. That is a pain but the best I currently imagine. |
Work around an issue on Windows with running scripts using `env -S` npm/cmd-shim#54
I'd argue that this is in fact a bug. Currently it's impossible to make If one writes If one writes A simple fix would be to use shims on Linux; then we wouldn't need But a probably better fix would be to detect The best workaround I found is to write a NodeJS wrapper that runs Node with the desired command-line options (so two Nodes end up running). Slows things down a bit, but at least it's functional. |
Linux needs `#!/usr/bin/env -S` but this breaks Windows shims <npm/cmd-shim#54> Wrap in another layer of Node as a workaround.
What / Why
When writing shims for node.js application entry-points it happens that we want to pass additional flags to node when starting.
env
supports this via the-S
flag. For example, one of my projects has this shebang in its entry-point:The flag
-S
tellsenv
to split the following text on whitespace and treat the segments as args to the executable in the first segment after the-S
(i.e.node
), instead of interpreting the rest of the line as one long command.This works without issue on *nix based systems (tested on manjaro, ubuntu, macOS).
When
When using this module to create the shim for a package with an entry-point whose shebang uses the
-S
flag, the-S
flag is interpreted as the name of the executable to run. This makes the resulting shim unusable.Where
This is the absolute opposite of a minimal example, but the issue occurs in an ongoing PR here[1].
If needed I can build a small reproduction repository.
How
Current Behavior
The
-S
flag in the shebang is interpreted as the name of the executable that the shim should run.Expected Behavior
I expect the
-S
flag to be ignored, since skipping it and using only the remaining shebang works on windows (according to my experiments).Who
References
The text was updated successfully, but these errors were encountered: