1a4e54154Smrg#!/usr/bin/env python3
2a4e54154Smrg#
3a4e54154Smrg# fontconfig/doc/run-quiet.py
4a4e54154Smrg#
5a4e54154Smrg# Runs command and discards anything it sends to stdout
6a4e54154Smrg#
7a4e54154Smrg# Copyright © 2020 Tim-Philipp Müller
8a4e54154Smrg#
9a4e54154Smrg# Permission to use, copy, modify, distribute, and sell this software and its
10a4e54154Smrg# documentation for any purpose is hereby granted without fee, provided that
11a4e54154Smrg# the above copyright notice appear in all copies and that both that
12a4e54154Smrg# copyright notice and this permission notice appear in supporting
13a4e54154Smrg# documentation, and that the name of the author(s) not be used in
14a4e54154Smrg# advertising or publicity pertaining to distribution of the software without
15a4e54154Smrg# specific, written prior permission.  The authors make no
16a4e54154Smrg# representations about the suitability of this software for any purpose.  It
17a4e54154Smrg# is provided "as is" without express or implied warranty.
18a4e54154Smrg#
19a4e54154Smrg# THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
20a4e54154Smrg# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
21a4e54154Smrg# EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
22a4e54154Smrg# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
23a4e54154Smrg# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
24a4e54154Smrg# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
25a4e54154Smrg# PERFORMANCE OF THIS SOFTWARE.
26a4e54154Smrgimport subprocess
27a4e54154Smrgimport sys
28a4e54154Smrgimport os
29a4e54154Smrg
30a4e54154Smrgif len(sys.argv) < 2:
31a4e54154Smrg  sys.exit('Usage: {} PROGRAM [ARGS..]'.format(sys.argv[0]))
32a4e54154Smrg
33a4e54154Smrgcommand = sys.argv[1:]
34a4e54154Smrg
35a4e54154Smrgwith open(os.devnull, 'w') as out:
36a4e54154Smrg  sys.exit(subprocess.run(command, stdout=out).returncode)
37