diff --git a/site/docs/user-manual.html b/site/docs/user-manual.html index 9502e9684f0a44..2538132931b163 100644 --- a/site/docs/user-manual.html +++ b/site/docs/user-manual.html @@ -2059,9 +2059,33 @@
bazel run
is similar, but not identical, to directly invoking
-the binary built by Bazel. In particular, this command does not run the target
-in the current working directory. bazel run
should not be used if
-the binary's behavior depends on the directory it's invoked in.
+the binary built by Bazel and its behavior is different depending on whether the
+binary to be invoked is a test or not.
+
+When the binary is not a test, the current working directory will be the
+runfiles tree of the binary.
+
+When the binary is a test, the current working directory will be the exec root
+and a good-faith attempt is made to replicate the environment tests are usually
+run in. The emulation is not perfect, though, and tests that have multiple
+shards cannot be run this way (the
+--test_sharding_strategy=disabled
command line option can be used
+to work around this)
+
+The following extra environment variables are also available to the binary:
+
BUILD_WORKSPACE_DIRECTORY
: the root of the workspace where the
+ build was run.
+ BUILD_WORKING_DIRECTORY
: the current working directory where
+ Bazel was run from.
+ bazel run