aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/External-commands.md
diff options
context:
space:
mode:
authorVolker Weißmann <volker.weissmann@gmx.de>2021-10-14 01:35:14 +0200
committerEli Schwartz <eschwartz93@gmail.com>2021-10-30 22:26:28 -0400
commit2c079d855ed87488bdcc6c5c06f59abdb9b85b6c (patch)
tree62206d581a9ff764d948da94d4478dba85bce765 /docs/markdown/External-commands.md
parent3c103fe49ccca848d255b9b00365e74ce35400a4 (diff)
downloadmeson-2c079d855ed87488bdcc6c5c06f59abdb9b85b6c.zip
meson-2c079d855ed87488bdcc6c5c06f59abdb9b85b6c.tar.gz
meson-2c079d855ed87488bdcc6c5c06f59abdb9b85b6c.tar.bz2
Added warning if run_command is called without the check kwarg
Diffstat (limited to 'docs/markdown/External-commands.md')
-rw-r--r--docs/markdown/External-commands.md11
1 files changed, 6 insertions, 5 deletions
diff --git a/docs/markdown/External-commands.md b/docs/markdown/External-commands.md
index 772459b..026ed54 100644
--- a/docs/markdown/External-commands.md
+++ b/docs/markdown/External-commands.md
@@ -8,18 +8,19 @@ As a part of the software configuration, you may want to get extra
data by running external commands. The basic syntax is the following.
```meson
-r = run_command('command', 'arg1', 'arg2', 'arg3')
-if r.returncode() != 0
- # it failed
-endif
+r = run_command('command', 'arg1', 'arg2', 'arg3', check: true)
output = r.stdout().strip()
errortxt = r.stderr().strip()
```
+If `check: true` is given, meson will error out if `command` returns with a
+non-zero exit code. Alternatively, you can set `check: false` and get the exit
+code with `r.returncode()`.
+
Since 0.52.0, you can pass the command environment as a dictionary:
```meson
-run_command('command', 'arg1', 'arg2', env: {'FOO': 'bar'})
+run_command('command', 'arg1', 'arg2', env: {'FOO': 'bar'}, check: true)
```
Since 0.50.0, you can also pass the command [[@env]] object: