Skip to content

Commit

Permalink
Clarify how to set $0 properly in run_in_shell_command (Cherry-pick…
Browse files Browse the repository at this point in the history
… of #19019) (#19031)

Fixes #19017 (well turns out it was a non-issue) by suggesting to users
how to get `$0` properly in their binaries.

Co-authored-by: Joshua Cannon <[email protected]>
  • Loading branch information
WorkerPants and thejcannon authored May 18, 2023
1 parent c3dddf9 commit b008277
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 ShellCommandOutputsField(StringSequenceField):
Expand Down

0 comments on commit b008277

Please sign in to comment.