Is there a flag I can pass in so that if pants doe...
# general
s
Is there a flag I can pass in so that if pants doesn’t find a target to
run
it will still return an exit code of 0? Also, thank you in advance…folks in this slack are super helpful and I’ve been learning a lot and making tons of progress
h
What is the command line you’d be running in such a case? Are you trying to glob over targets and find exactly one to run, for example?
s
@breezy-twilight-65275 exactly….(sorry I didn’t supply the example first). The original case I was trying to do that gives me an error is
Copy code
pants --changed-since=origin/main --changed-dependents=transitive --filter-tag-regex='^my-tag$' run
So I’ve currently implemented:
Copy code
TARGETS=$(pants --changed-since=origin/main --changed-dependents=transitive --filter-tag-regex='^my-tag$' list)
if [[ -z "$TARGETS" ]]; then
  echo "no targets to run on"
else
  pants --spec-files=<(echo $TARGETS) run
fi
I’d love if I could do this because then it could just be a single line that I could even add to the cli helpers for everyone to do on their own machine (and on CLI)
Copy code
pants --NEW_IDEA_ALLOW_ERRORS=NoTargetFound --changed-since=origin/main --changed-dependents=transitive --filter-tag-regex='^my-tag$' run
h
I was under the impression that you can only
run
a single target per Pants invocation
yeah
Copy code
The `run` goal only works with one valid target, but was given multiple valid targets
Which makes sense, because what order would you run them in?
s
Ah! Ok, that makes sense, thanks for taking time to explain this to me!