File: silence

package info (click to toggle)
matplotlib 3.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 77,480 kB
  • sloc: python: 124,525; cpp: 58,549; ansic: 29,599; objc: 2,348; makefile: 148; sh: 57
file content (14 lines) | stat: -rwxr-xr-x 284 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash

# Run a command, hiding its standard output and error if its exit
# status is zero.

stdout=$(mktemp -t stdout) || exit 1
stderr=$(mktemp -t stderr) || exit 1
"$@" >$stdout 2>$stderr
code=$?
if [[ $code != 0 ]]; then
    cat $stdout
    cat $stderr >&2
    exit $code
fi