verbosely telling subprocess to not open a command window on Windows platforms

This commit is contained in:
Alan Hamlett 2013-08-03 03:10:13 -07:00
parent 3bd9c31247
commit bc8c1af287

View File

@ -15,7 +15,7 @@ import platform
import time import time
import uuid import uuid
from os.path import expanduser, dirname, realpath, isfile, join, exists from os.path import expanduser, dirname, realpath, isfile, join, exists
from subprocess import call, Popen from subprocess import call, Popen, STARTUPINFO, STARTF_USESHOWWINDOW
# globals # globals
@ -79,7 +79,9 @@ def api(targetFile, timestamp, isWrite=False, endtime=0):
cmd.extend(['--endtime', str('%f' % endtime)]) cmd.extend(['--endtime', str('%f' % endtime)])
#print(cmd) #print(cmd)
if platform.system() == 'Windows': if platform.system() == 'Windows':
Popen(cmd) startupinfo = STARTUPINFO()
startupinfo.dwFlags |= STARTF_USESHOWWINDOW
Popen(cmd, startupinfo=startupinfo)
else: else:
with open(join(expanduser('~'), '.wakatime.log'), 'a') as stderr: with open(join(expanduser('~'), '.wakatime.log'), 'a') as stderr:
Popen(cmd, stderr=stderr) Popen(cmd, stderr=stderr)