> ## Documentation Index
> Fetch the complete documentation index at: https://aspect.build/llms.txt
> Use this file to discover all available pages before exploring further.

# Runnable

`function` **Runnable.command**

<pre language="python">
  `def Runnable.command(
  *,
  args: list[str] = [],
  env: dict[str, None | str] = ...,
  cwd: None | str = None
  ) -> std.process.Command`
</pre>

A `std.process.Command` set up the way `bazel run` would start this target, for callers that want to spawn it themselves.

The argv is the target's `args` attribute followed by `args`. The
environment is `RunEnvironmentInfo`, then `BUILD_WORKSPACE_DIRECTORY`,
`BUILD_WORKING_DIRECTORY` and the `ASPECT_*` directories, then the
runfiles variables when the target has a runfiles tree, then `env`,
where a `None` value removes the variable. `cwd` defaults to
`workspace_dir`, the directory `bazel run` uses, else the directory
the task was invoked from. The command spawns in its own process
group, so cancelling its token stops everything it started.

```python theme={null}
child = r.command(args = ["--port", "8080"]).stdout("piped").spawn()
```

`property` **Runnable.args**

<pre language="python">
  `Runnable.args: list[str]`
</pre>

The target's `args` attribute, location- and make-variable-expanded and shell-tokenized the way `bazel run` does it.

`property` **Runnable.default\_outputs**

<pre language="python">
  `Runnable.default_outputs: list[str]`
</pre>

Absolute paths of every file in the target's default output group, the executable among them.

`property` **Runnable.env**

<pre language="python">
  `Runnable.env: list[(str, str)]`
</pre>

`RunEnvironmentInfo.environment`: the variables the rule asks to be set when the target runs.

`property` **Runnable.exec\_path**

<pre language="python">
  `Runnable.exec_path: str`
</pre>

The executable's path relative to the execution root, e.g. `bazel-out/k8-fastbuild/bin/pkg/tool`.

`property` **Runnable.inherited\_env**

<pre language="python">
  `Runnable.inherited_env: list[str]`
</pre>

`RunEnvironmentInfo.inherited_environment`: variable names the rule asks to be passed through from the invoking environment. They are, by virtue of the process inheriting the CLI's environment.

`property` **Runnable.label**

<pre language="python">
  `Runnable.label: str`
</pre>

The target, as it was asked for.

`property` **Runnable.path**

<pre language="python">
  `Runnable.path: str`
</pre>

The executable's absolute path on disk.

`property` **Runnable.runfiles\_dir**

<pre language="python">
  `Runnable.runfiles_dir: None | str`
</pre>

The materialized runfiles tree, `<path>.runfiles`, or `None` when the executable has no runfiles. It exists by the time you hold this value.

`property` **Runnable.runfiles\_exec\_path**

<pre language="python">
  `Runnable.runfiles_exec_path: str`
</pre>

The runfiles directory's path relative to the execution root: `exec_path + ".runfiles"`.

`property` **Runnable.runfiles\_manifest**

<pre language="python">
  `Runnable.runfiles_manifest: None | str`
</pre>

The input runfiles manifest Bazel wrote next to the executable, or `None` for an executable without runfiles support.

`property` **Runnable.tags**

<pre language="python">
  `Runnable.tags: list[str]`
</pre>

The target's `tags`.

`property` **Runnable.workspace\_dir**

<pre language="python">
  `Runnable.workspace_dir: None | str`
</pre>

`runfiles_dir/<workspace_name>`, the working directory `bazel run` starts the process in, or `None` without a runfiles tree.

`property` **Runnable.workspace\_name**

<pre language="python">
  `Runnable.workspace_name: str`
</pre>

The main repository's name inside runfiles trees: `_main` under bzlmod, the `WORKSPACE` name otherwise.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.