You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/usr/bin/env -S deno run --unstable --allow-write --allow-read --allow-run
// ...etc...
Perhaps if the script has a shebang starting with #!/usr/bin/env -S then deno task should just figure this out. This apparently already works on Mac so making this work on all platforms would reduce some issues.
I like this method because it keeps the required permissions close to the actual file, and running the script is extremely simple because all you have to do is run ./tools/format.js.
But the downside is... it doesn't work very well on Windows. Maybe I'm missing a simple solution for this, but as far as I can tell /usr/bin/env is not really a thing on Windows, and shebang support isn't great either. So Windows users are stuck with having to run scripts using deno run while trying to figure out what the required permissions are (or running with -A).
This wasn't a huge problem for me though. I'm mostly developing on macOS, so I was using shebangs for now, though I did want to have better cross platform support eventually.
To implement this, I think we should attempt to parse the shebang. If we can, execute it the same way on all platforms. If we can't, we should try to run it as a command, but print a warning saying it won't work cross platform and to recommend fixing the shebang.
The text was updated successfully, but these errors were encountered:
dsherret
changed the title
Ability to execute files with shebang?
Ability to execute files with shebang on Windows and older versions of Ubuntu?
Mar 19, 2022
...since the two codebases are similar, maybe what's done there could give some guidance for how a first pass of this feature might be implemented here.
For example, say you had:
And the script had:
#!/usr/bin/env -S deno run --unstable --allow-write --allow-read --allow-run // ...etc...
Perhaps if the script has a shebang starting with
#!/usr/bin/env -S
then deno task should just figure this out. This apparently already works on Mac so making this work on all platforms would reduce some issues.From @jespertheend in denoland/deno#14036
To implement this, I think we should attempt to parse the shebang. If we can, execute it the same way on all platforms. If we can't, we should try to run it as a command, but print a warning saying it won't work cross platform and to recommend fixing the shebang.
The text was updated successfully, but these errors were encountered: