<#20491 Add support for `pants run :file_target`> ...
# github-notifications
c
#20491 Add support for `pants run :file_target` Issue created by tgolsson Is your feature request related to a problem? Please describe. For integration with adhoc_tool it would be nice if
file
targets could be ran. For example,
Copy code
file(
    name="my_binary",
    source=http_source(...)
)

adhoc_tool(
    runnable=":my_binary",
)
Currently, this does not work due to the following snippet: pants/src/python/pants/core/util_rules/adhoc_process_support.py Lines 404 to 421 in </pantsbuild/pants/commit/a4fbfb8db2dfcb7d2872ba981285db0e81c48b2f|a4fbfb8> Since the file target isn't runnable, it fails to find any matching field sets and crashes with a very ugly error due to [0] being out of bounds of the result tuple. Describe the solution you'd like I'd love to be able to mark a file as executable, allowing it to be used directly with adhoc_tool. This might be necessary to do both at the
http_source
level to set the executable bit, as well as on the
file
level to enable the field set.
Copy code
file(
    name="my_binary",
    source=http_source(
        ...,
        override_modes="+x",
    ), 
    executable=True,
)
Describe alternatives you've considered It seems like one can use
shell_command
here instead of
adhoc_tool
, but adhoc_tool seems better suited for what I'm trying to achieve. Additional context https://pantsbuild.slack.com/archives/C0D7TNJHL/p1707143905353629 pantsbuild/pants