Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] Replace script_runner with explicitly required shebang lines? #130

Closed
SamuelMarks opened this issue Nov 11, 2018 · 5 comments
Closed
Assignees
Labels
Milestone

Comments

@SamuelMarks
Copy link

Problem Description

With the exception of @shell, why not just use the shebang line?

Yes, Rust can be covered also, see this stackoverflow question.

Seems like a much more general solution than your current one.

What do you think 馃槃 ?

@sagiegurari sagiegurari self-assigned this Nov 11, 2018
@sagiegurari
Copy link
Owner

not sure about that as its pretty much the same thing but less structured.
meaning, why would some attributes you would put as toml attributes and some you would embed inside the script text? what do we gain?
also it would hurt multi platform support due to 2 reasons

  • windows doesn't know what that shebang line is and it would probably fail. comments in windows batch files use the @REM prefix
  • it may cause lots of duplicate code, for example, this task would invoke a python script.
    The python executable is defined in the runner.
[tasks.python]
script_runner = "python"
script_extension = "py"
script = [
'''
print("Hello, World!")
'''
]

for windows you might want to replace it to pythonw

[tasks.python]
script_runner = "pythonw"

if it was embedded in the script, you would have to copy the entire script again which would mean duplicate the code there and would be harder to maintain.

@SamuelMarks
Copy link
Author

On the Windows point, you are correct, with Windows Batch files. Usually, you'd do a two-step magic number check:

  1. Check file extension
  2. If file is encoded as text, check shebang line, else check magic bytes to confirm it can be run on this platform (you are doing this partially already, with your platform underscore filename syntax)

On the package management side, I'm imaging a new URI command to choose central repostiory, and one that will fetch to/from global鈥攐r local?鈥攃ache.

So now you need this sort of syntax, because you can then have a:

[tasks.clean]
script = "pkg://default_cleaner"

@sagiegurari
Copy link
Owner

ok I understand what's the end goal here. I wonder if the load scripts feature would basically resolve that by having those scripts in a common makefile that you can than use to call the defined tasks there.

@sagiegurari
Copy link
Owner

@SamuelMarks this is now implemented.
hoped your PR would go in but didn't get any response and already made changes which resulted in making this request really simple.

@sagiegurari
Copy link
Owner

@SamuelMarks published in 0.16.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants