`bazel run --script_path=test` fails silently when target uses `shard_count`
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 75
Description
### Description of the bug:
When you run `bazel run --script_path=test ` and the target is a test target that uses `shard_count`, Bazel exits with status code 2 with no indication of why.
The expected behavior is either that it succeeds (preferred) or that Bazel prints a diagnostic that explains that `--script_path` cannot be used on targets that use `shard_count`. In the latter case, this limitation should also be mentioned in [the documentation for `--script_path`](https://bazel.build/reference/command-line-reference#flag--script_path).
### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Minimal example: https://github.com/jfirebaugh/bazel_cc_test_output/tree/script_path
### Which operating system are you running Bazel on?
macOS
### What is the output of `bazel info release`?
release 5.3.0
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
_No response_
### What's the output of `git remote get-url origin; git rev-parse master; git rev-parse HEAD` ?
_No response_
### Have you found anything relevant by searching the web?
_No response_
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Research direction
Start with the linked minimal example and reproduce `bazel run --script_path=test ` for a test target using `shard_count`. Trace the `--script_path` handling, then verify that the command either succeeds or reports the limitation; if it remains unsupported, update the linked `--script_path` command-line documentation.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100