Skip to content

Instantly share code, notes, and snippets.

@leotada
Created September 6, 2017 12:43
Show Gist options
  • Save leotada/ef4f6ec085b242c3aada09c861d531d5 to your computer and use it in GitHub Desktop.
Save leotada/ef4f6ec085b242c3aada09c861d531d5 to your computer and use it in GitHub Desktop.
Python subprocess without window
def runprocess(command):
"Executa subprocess multiplataforma sem exibir janela. Retorna o returncode."
startupinfo = None
if os.name == 'nt':
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
retcode = subprocess.check_call(command, startupinfo=startupinfo)
return retcode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment