fresh-continent-76371
02/19/2024, 12:42 PMcurved-television-6568
02/19/2024, 1:37 PMshell_command allows you to run any executable you may find on your system, in a sandbox along with any target dependencies, as part of another pants goal.
The run_shell_command does the same, but as a stand alone pants goal, and runs in your workspace and any target dependencies are placed to the side in a "{chroot}" you can reference to get at them.
adhoc_tool then is, I think, an evolution of shell_command where you can leverage any runnable pants target as the command to execute, and also have more (better) support for optionally capturing stdout/stderr as proper outputs for downstream targets to consume. I have only vague familiarity with adhoc_tool as I've not really used it at all (yet), where as I wrote the initial implementation for the shell command variants in their experimental version before graduating.happy-kitchen-89482
02/19/2024, 4:36 PMthankful-stone-5860
02/20/2024, 3:57 PMshell_command , as Andreas explained, runs in a sandbox but is not a directly runnable target (i.e. you can't pants run :my_shell_command). That's where run_shell_command comes in, as you can run it via pants run ..., but it runs in your project root instead of a sandbox.
adhoc_tool combines a bit of both, but I like to think of it as a cacheable command where you need some output effect to run your next command. Think of it like running npm install to refresh your node_modules before running a runnable target like npm run-script serve.
All of this is IMHO, as I'm not an expert in its entirety.fresh-continent-76371
02/27/2024, 10:59 AM