Advertisement
cooperlees

Untitled

May 31st, 2017
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. import subprocess
  2.  
  3. def run_some_cmd(cmd: str, quiet: bool=False) -> None:
  4.     stdouterr = open(os.devnull, 'w') if quiet else None
  5.     try:
  6.         subprocess.check_call(cmd, close_fds=True,
  7.                               stdout=stdouterr, stderr=stdouterr)
  8.     finally:
  9.         if stdouterr:
  10.             stdouterr.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement