utility function to check if running on Windows platform

This commit is contained in:
Alan Hamlett 2017-04-13 00:19:37 -07:00
parent 2f5c426b8c
commit ee7854b171
1 changed files with 9 additions and 2 deletions

View File

@ -152,6 +152,13 @@ let s:VERSION = '4.0.14'
return join(safeArgs, ' ')
endfunction
function! s:IsWindows()
if has('win32') || has('win64')
return s:true
endif
return s:false
endfunction
function! s:SendHeartbeat(file, time, is_write, last)
let file = a:file
if file == ''
@ -159,7 +166,7 @@ let s:VERSION = '4.0.14'
endif
if file != ''
let python_bin = g:wakatime_PythonBinary
if has('win32') || has('win64')
if s:IsWindows()
if python_bin == 'python'
let python_bin = 'pythonw'
endif
@ -180,7 +187,7 @@ let s:VERSION = '4.0.14'
if s:is_debug_mode_on
echo 'Sending Heartbeat with Command: ' . s:JoinArgs(cmd)
endif
if has('win32') || has('win64')
if s:IsWindows()
exec 'silent !start /min cmd /c "' . s:JoinArgs(cmd) . '"'
else
let stdout = system(s:JoinArgs(cmd) . ' &')