| Serge Bazanski | 140bddc | 2020-06-05 21:01:19 +0200 | [diff] [blame] | 1 | savestdout |
| 2 | ========== |
| 3 | |
| 4 | `savestdout` is a small tool to save the stdout of a command to a file, without using |
| 5 | a shell. |
| 6 | |
| 7 | It was made to be used in Bazel rule definitions that want to run a command and save |
| Serge Bazanski | 662b5b3 | 2020-12-21 13:49:00 +0100 | [diff] [blame] | 8 | its output to stdout without going through `ctx.actions.run\_shell`. |
| Serge Bazanski | 140bddc | 2020-06-05 21:01:19 +0200 | [diff] [blame] | 9 | |
| 10 | Once [bazelbuild/bazel/issues/5511](https://github.com/bazelbuild/bazel/issues/5511) |
| 11 | gets fixed, rules that need this behaviour can start using native Bazel functionality |
| 12 | instead, and this tool should be deleted. |
| 13 | |
| 14 | Usage |
| 15 | ----- |
| 16 | |
| 17 | Command line usage: |
| 18 | |
| 19 | bazel build //build/savestdout |
| 20 | bazel run bazel-bin/build/savestdout/*/savestdout /tmp/foo ps aux |
| 21 | |
| Serge Bazanski | 662b5b3 | 2020-12-21 13:49:00 +0100 | [diff] [blame] | 22 | For an example of use in rules, see `node_initramfs` in `//code/def.bzl`. |