From 42f444ce3871890250b0aef74c68aa1f9d5b8232 Mon Sep 17 00:00:00 2001 From: Joshua Cannon Date: Tue, 16 May 2023 16:21:31 -0500 Subject: [PATCH] Clarify how to set $0 properly in `run_in_shell_command` (#19019) Fixes #19017 (well turns out it was a non-issue) by suggesting to users how to get `$0` properly in their binaries. --- src/python/pants/backend/shell/target_types.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/python/pants/backend/shell/target_types.py b/src/python/pants/backend/shell/target_types.py index 596eead06004..428d93510e87 100644 --- a/src/python/pants/backend/shell/target_types.py +++ b/src/python/pants/backend/shell/target_types.py @@ -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 ' by default." + help = help_text( + """ + Shell command to execute. + + The command is executed as 'bash -c ' by default. If you want to invoke a binary + use `exec -a $0 ` as the command so that the binary gets the correct `argv[0]` + set. + """ + ) class ShellCommandOutputsField(StringSequenceField):