Introduces kickstart.suppress_error function
This commit is contained in:
parent
6538dd4bde
commit
38ad846aeb
15
docs/kickstart/suppress_error.md
Normal file
15
docs/kickstart/suppress_error.md
Normal file
@ -0,0 +1,15 @@
|
||||
# kickstart.suppress_error command to run
|
||||
Run the command with stder outputing to /dev/null.
|
||||
Inform it is about to run.
|
||||
|
||||
When debug flag is enable, does not redirect stderr to help debugging.
|
||||
Returns the command result.
|
||||
|
||||
### Example
|
||||
|
||||
```bash
|
||||
$ kickstart.suppress_error dpkg -s pkg-that-does-not-exist | grep 'Status:'
|
||||
Running "dpkg -s pkg-that-does-not-exist"
|
||||
```
|
||||
|
||||
If there was an error executing `dpkg`, it will not show up on the console unless the debugg flag is enabled.
|
@ -22,6 +22,16 @@ kickstart.mute() {
|
||||
return $?
|
||||
}
|
||||
|
||||
kickstart.suppress_error() {
|
||||
kickstart.info "Running \"$*\""
|
||||
if kickstart.debugging; then
|
||||
"$@"
|
||||
else
|
||||
"$@" 2>/dev/null
|
||||
fi
|
||||
return $?
|
||||
}
|
||||
|
||||
kickstart.command_exists() {
|
||||
kickstart.mute which "$1"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user