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
1 changed files with 4 additions and 2 deletions

View File

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