# std.Build.Step.Run: Enable passing \(generated\) file content as args · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/be571f32c323d05e7348ac78e16c77b6004485f7)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: be571f32c323d05e7348ac78e16c77b6004485f7

Requested commit: be571f32c323d05e7348ac78e16c77b6004485f7

Commit: be571f32c323d05e7348ac78e16c77b6004485f7

Tree: cebf2a6964952630ca00ea768efa094826b2053a

Author: Justus Klausecker

Committer: Andrew Kelley

## Message

```
std.Build.Step.Run: Enable passing (generated) file content as args
Adds `addFileContentArg` and `addPrefixedFileContentArg` to pass the content
of a file with a lazy path as an argument to a `std.Build.Step.Run`.
This enables replicating shell `$()` / cmake `execute_process` with `OUTPUT_VARIABLE`
as an input to another `execute_process` in conjuction with `captureStdOut`/`captureStdErr`.

To also be able to replicate `$()` automatically trimming trailing newlines and cmake
`OUTPUT_STRIP_TRAILING_WHITESPACE`, this patch adds an `options` arg to those functions
which allows specifying the desired handling of surrounding whitespace.

The `options` arg also allows to specify a custom `basename` for the output. e.g.
to add a file extension (concrete use case: Zig `@import()` requires files to have a
`.zig`/`.zon` extension to recognize them as valid source files).

```

## Parents

- [164c598cd85092323ef16640fd533d325fa74944](https://git.cafe/gitcafe/zig/commit/164c598cd85092323ef16640fd533d325fa74944?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/be571f32c323d05e7348ac78e16c77b6004485f7?format=markdown)
