Skip to content

Commit

Permalink
Clarify how to set $0 properly in run_in_shell_command (pantsbuild#…
Browse files Browse the repository at this point in the history
…19019)

Fixes pantsbuild#19017 (well turns out it was a non-issue) by suggesting to users
how to get `$0` properly in their binaries.
  • Loading branch information
thejcannon authored May 16, 2023
1 parent fbc53f0 commit 1026adc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/python/pants/backend/shell/target_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,15 @@ class ShellSourcesGeneratorTarget(TargetFilesGenerator):
class ShellCommandCommandField(StringField):
alias = "command"
required = True
help = "Shell command to execute.\n\nThe command is executed as 'bash -c <command>' by default."
help = help_text(
"""
Shell command to execute.
The command is executed as 'bash -c <command>' by default. If you want to invoke a binary
use `exec -a $0 <binary> <args>` as the command so that the binary gets the correct `argv[0]`
set.
"""
)


class ShellCommandOutputFilesField(AdhocToolOutputFilesField):
Expand Down

0 comments on commit 1026adc

Please sign in to comment.