Last active
December 19, 2015 10:19
-
-
Save ichizok/5939819 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* shell command | |
----------------------------------------------------------------------------------------- | |
$ cat <<EOT | sqlite3 a.db | |
CREATE TABLE people (id int, friend int); | |
CREATE INDEX _id ON people (id); | |
begin; | |
$( | |
declare -i i=0 | |
for i in $(seq 0 999); do | |
echo "INSERT INTO people VALUES ($i, $(($i+1)))" | |
done | |
) | |
end; | |
EOT | |
$ vim --cmd 'profile start profile.txt' --cmd 'profile! file ~/.vim/bundle/vimproc.vim/autoload/vimproc.vim' +'so database-sqlite.vim' +q | |
----------------------------------------------------------------------------------------- | |
* database-sqlite.vim | |
----------------------------------------------------------------------------------------- | |
let s:S = vital#of('vital').import('Database.Sqlite') | |
for i in range(0, 999) | |
call s:S.query( | |
\ 'a.db', | |
\ 'SELECT * FROM people WHERE id = ?;', | |
\ [i]) | |
endfor | |
----------------------------------------------------------------------------------------- | |
* profile.txt | |
----------------------------------------------------------------------------------------- | |
SCRIPT /Users/Experiment/.dotfiles/vim/bundle/vimproc.vim/autoload/vimproc.vim | |
Sourced 1 time | |
Total time: 0.004102 | |
Self time: 0.003114 | |
count total (s) self (s) | |
"============================================================================= | |
" FILE: vimproc.vim | |
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com> (Modified) | |
" Yukihiro Nakadaira <yukihiro.nakadaira at gmail.com> (Original) | |
" Last Modified: 25 Jun 2013. | |
" License: MIT license {{{ | |
" Permission is hereby granted, free of charge, to any person obtaining | |
" a copy of this software and associated documentation files (the | |
" "Software"), to deal in the Software without restriction, including | |
" without limitation the rights to use, copy, modify, merge, publish, | |
" distribute, sublicense, and/or sell copies of the Software, and to | |
" permit persons to whom the Software is furnished to do so, subject to | |
" the following conditions: | |
" | |
" The above copyright notice and this permission notice shall be included | |
" in all copies or substantial portions of the Software. | |
" | |
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | |
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
" }}} | |
"============================================================================= | |
" Saving 'cpoptions' {{{ | |
1 0.000012 let s:save_cpo = &cpo | |
1 0.000006 set cpo&vim | |
" }}} | |
1 0.000003 function! s:print_error(string) | |
echohl Error | echomsg a:string | echohl None | |
endfunction | |
" MacVim trouble shooter {{{ | |
1 0.000353 if vimproc#util#is_mac() && !&encoding | |
1 0.000078 set encoding=utf-8 | |
1 0.000001 endif | |
"}}} | |
" Check 'encoding' "{{{ | |
1 0.000005 if &encoding =~# '^euc-jp' | |
call s:print_error('Sorry, vimproc is not supported this encoding environment.') | |
call s:print_error('You should set ''encoding'' option to "utf-8" ' | |
\ .'and set ''termencoding'' option to "euc-jp".') | |
finish | |
endif | |
"}}} | |
" Global options definition. "{{{ | |
" Set the default of g:vimproc_dll_path by judging OS "{{{ | |
1 0.000006 0.000004 if vimproc#util#is_windows() | |
if has('win64') | |
let s:vimproc_dll_basename = 'vimproc_win64.dll' | |
else | |
let s:vimproc_dll_basename = 'vimproc_win32.dll' | |
endif | |
elseif vimproc#util#is_cygwin() | |
let s:vimproc_dll_basename = 'vimproc_cygwin.dll' | |
elseif vimproc#util#is_mac() | |
1 0.000003 let s:vimproc_dll_basename = 'vimproc_mac.so' | |
1 0.000001 else | |
let s:vimproc_dll_basename = 'vimproc_unix.so' | |
endif | |
"}}} | |
1 0.000031 0.000017 call vimproc#util#set_default( | |
\ 'g:vimproc#dll_path', | |
\ expand('<sfile>:p:h') . '/' . s:vimproc_dll_basename, | |
\ 'g:vimproc_dll_path') | |
1 0.000002 unlet s:vimproc_dll_basename | |
1 0.000024 0.000011 call vimproc#util#set_default( | |
\ 'g:vimproc#password_pattern', | |
\ '\%(Enter \|[Oo]ld \|[Nn]ew \|login ' . | |
\'\|Kerberos \|CVS \|UNIX \| SMB \|LDAP \|\[sudo] ' . | |
\'\|^\|\n\|''s \)\%([Pp]assword\|[Pp]assphrase\)\>', | |
\ 'g:vimproc_password_pattern') | |
1 0.000028 0.000015 call vimproc#util#set_default( | |
\ 'g:vimproc#popen2_commands', { | |
\ 'sh' : 1, 'bash' : 1, 'zsh' : 1, 'csh' : 1, 'tcsh' : 1, | |
\ 'tmux' : 1, 'screen' : 1, 'su' : 1, | |
\ 'python' : 1, 'rhino' : 1, 'ipython' : 1, 'ipython3' : 1, 'yaourt' : 1, | |
\ }, 'g:vimproc_popen2_commands') | |
1 0.000018 0.000006 call vimproc#util#set_default( | |
\ 'g:stdinencoding', 'char') | |
1 0.000020 0.000009 call vimproc#util#set_default( | |
\ 'g:stdoutencoding', 'char') | |
1 0.000015 0.000005 call vimproc#util#set_default( | |
\ 'g:stderrencoding', 'char') | |
"}}} | |
" Constants {{{ | |
1 0.000002 let g:vimproc#SIGINT = 2 | |
1 0.000002 let g:vimproc#SIGQUIT = 3 | |
1 0.000002 let g:vimproc#SIGILL = 4 | |
1 0.000002 let g:vimproc#SIGABRT = 6 | |
1 0.000002 let g:vimproc#SIGFPE = 8 | |
1 0.000002 let g:vimproc#SIGKILL = 9 | |
1 0.000002 let g:vimproc#SIGSEGV = 11 | |
1 0.000002 let g:vimproc#SIGPIPE = 13 | |
1 0.000002 let g:vimproc#SIGALRM = 14 | |
1 0.000001 let g:vimproc#SIGTERM = 15 | |
1 0.000002 let g:vimproc#SIGUSR1 = 10 | |
1 0.000002 let g:vimproc#SIGUSR2 = 12 | |
1 0.000001 let g:vimproc#SIGCHLD = 17 | |
1 0.000001 let g:vimproc#SIGCONT = 18 | |
1 0.000002 let g:vimproc#SIGSTOP = 19 | |
1 0.000002 let g:vimproc#SIGTSTP = 20 | |
1 0.000001 let g:vimproc#SIGTTIN = 21 | |
1 0.000001 let g:vimproc#SIGTTOU = 22 | |
1 0.000002 let g:vimproc#SIGWINCH = 28 | |
" }}} | |
1 0.000046 0.000022 let g:vimproc#dll_path = | |
\ vimproc#util#iconv( | |
\ vimproc#util#substitute_path_separator(g:vimproc#dll_path), | |
\ &encoding, vimproc#util#termencoding()) | |
" Backward compatibility. | |
1 0.000003 let g:vimproc_password_pattern = g:vimproc#password_pattern | |
1 0.000037 if !filereadable(g:vimproc#dll_path) "{{{ | |
function! vimproc#get_last_status() | |
return v:shell_error | |
endfunction | |
function! vimproc#get_last_errmsg() | |
return '' | |
endfunction | |
function! vimproc#system(...) | |
return call('system', a:000) | |
endfunction | |
echoerr printf('vimproc''s DLL: "%s" is not found. | |
\ Please read :help vimproc and make it.', g:vimproc#dll_path) | |
finish | |
endif"}}} | |
1 0.000002 function! vimproc#version() "{{{ | |
return str2nr(printf('%2d%02d', 7, 1)) | |
endfunction"}}} | |
1 0.000002 function! vimproc#dll_version() "{{{ | |
let [dll_version] = s:libcall('vp_dlversion', []) | |
return str2nr(dll_version) | |
endfunction"}}} | |
"----------------------------------------------------------- | |
" API | |
1 0.000002 function! vimproc#open(filename) "{{{ | |
let filename = vimproc#util#iconv(fnamemodify(a:filename, ':p'), | |
\ &encoding, vimproc#util#termencoding()) | |
if filename =~ '^\%(https\?\|ftp\)://' | |
\ && !vimproc#host_exists(filename) | |
" URI is invalid. | |
call s:print_error('vimproc#open: URI "' . filename . '" is invalid.') | |
return | |
endif | |
" Detect desktop environment. | |
if vimproc#util#is_windows() | |
" For URI only. | |
"execute '!start rundll32 url.dll,FileProtocolHandler' filename | |
call s:libcall('vp_open', [filename]) | |
elseif has('win32unix') | |
" Cygwin. | |
call vimproc#system(['cygstart', filename]) | |
elseif executable('xdg-open') | |
" Linux. | |
call vimproc#system_bg(['xdg-open', filename]) | |
elseif exists('$KDE_FULL_SESSION') && $KDE_FULL_SESSION ==# 'true' | |
" KDE. | |
call vimproc#system_bg(['kioclient', 'exec', filename]) | |
elseif exists('$GNOME_DESKTOP_SESSION_ID') | |
" GNOME. | |
call vimproc#system_bg(['gnome-open', filename]) | |
elseif executable('exo-open') | |
" Xfce. | |
call vimproc#system_bg(['exo-open', filename]) | |
elseif vimproc#util#is_mac() && executable('open') | |
" Mac OS. | |
call vimproc#system_bg(['open', filename]) | |
else | |
" Give up. | |
call s:print_error('vimproc#open: Not supported.') | |
endif | |
endfunction"}}} | |
1 0.000003 function! vimproc#get_command_name(command, ...) "{{{ | |
let path = get(a:000, 0, $PATH) | |
let cnt = a:0 < 2 ? 1 : a:2 | |
let files = split(substitute(vimproc#util#substitute_path_separator( | |
\ vimproc#filepath#which(a:command, path)), '//', '/', 'g'), '\n') | |
if cnt < 0 | |
return files | |
endif | |
let file = get(files, 0, '') | |
if file == '' | |
throw printf( | |
\ 'vimproc#get_command_name: File "%s" is not found.', a:command) | |
endif | |
return file | |
endfunction"}}} | |
1 0.000004 function! s:system(cmdline, is_passwd, input, timeout, is_pty) "{{{ | |
if empty(a:cmdline) | |
let s:last_status = 0 | |
let s:last_errmsg = '' | |
return '' | |
endif | |
" Open pipe. | |
let subproc = (type(a:cmdline[0]) == type('')) ? vimproc#popen3(a:cmdline) : | |
\ a:is_pty ? vimproc#ptyopen(a:cmdline): | |
\ vimproc#pgroup_open(a:cmdline) | |
if a:input != '' | |
" Write input. | |
call subproc.stdin.write(a:input) | |
endif | |
if a:timeout > 0 && has('reltime') && v:version >= 702 | |
let start = reltime() | |
let timeout = a:timeout | |
else | |
let timeout = 0 | |
endif | |
if !a:is_passwd | |
call subproc.stdin.close() | |
endif | |
let output = '' | |
let s:last_errmsg = '' | |
while !subproc.stdout.eof || !subproc.stderr.eof | |
if timeout > 0 "{{{ | |
" Check timeout. | |
let end = split(reltimestr(reltime(start)))[0] * 1000 | |
if end > timeout && !subproc.stdout.eof | |
" Kill process. | |
" 15 == SIGTERM | |
try | |
call subproc.kill(15) | |
call subproc.waitpid() | |
catch | |
" Ignore error. | |
endtry | |
throw 'vimproc: vimproc#system(): Timeout.' | |
endif | |
endif"}}} | |
if !subproc.stdout.eof "{{{ | |
let out = subproc.stdout.read(1000, 0) | |
if a:is_passwd && out =~# g:vimproc_password_pattern | |
redraw | |
echo out | |
" Password input. | |
set imsearch=0 | |
let in = vimproc#util#iconv(inputsecret('Input Secret : ')."\<NL>", | |
\ &encoding, vimproc#util#termencoding()) | |
call subproc.stdin.write(in) | |
else | |
let output .= out | |
endif | |
endif"}}} | |
if !subproc.stderr.eof "{{{ | |
let out = subproc.stderr.read(1000, 0) | |
if a:is_passwd && out =~# g:vimproc_password_pattern | |
redraw | |
echo out | |
" Password input. | |
set imsearch=0 | |
let in = vimproc#util#iconv(inputsecret('Input Secret : ') . "\<NL>", | |
\ &encoding, vimproc#util#termencoding()) | |
call subproc.stdin.write(in) | |
else | |
let s:last_errmsg .= out | |
let output .= out | |
endif | |
endif"}}} | |
endwhile | |
let [cond, status] = subproc.waitpid() | |
" Newline convert. | |
if vimproc#util#is_mac() | |
let output = substitute(output, '\r\n\@!', '\n', 'g') | |
elseif has('win32') || has('win64') | |
let output = substitute(output, '\r\n', '\n', 'g') | |
endif | |
return output | |
endfunction"}}} | |
1 0.000003 function! vimproc#system(cmdline, ...) "{{{ | |
if type(a:cmdline) == type('') | |
if a:cmdline =~ '&\s*$' | |
let cmdline = substitute(a:cmdline, '&\s*$', '', '') | |
return vimproc#system_bg(cmdline) | |
endif | |
let args = vimproc#parser#parse_statements(a:cmdline) | |
for arg in args | |
let arg.statement = vimproc#parser#parse_pipe(arg.statement) | |
endfor | |
else | |
let args = [{'statement' : | |
\ [{ 'fd' : { 'stdin' : '', 'stdout' : '', 'stderr' : '' }, | |
\ 'args' : a:cmdline }], 'condition' : 'always' }] | |
endif | |
let timeout = get(a:000, 1, 0) | |
let input = get(a:000, 0, '') | |
return s:system(args, 0, input, timeout, 0) | |
endfunction"}}} | |
1 0.000002 function! vimproc#system2(...) "{{{ | |
if empty(a:000) | |
return '' | |
endif | |
if len(a:0) > 1 | |
let args = deepcopy(a:000) | |
let args[1] = vimproc#util#iconv( | |
\ args[1], &encoding, vimproc#util#stdinencoding()) | |
else | |
let args = a:000 | |
endif | |
let output = call('vimproc#system', args) | |
" This function converts application encoding to &encoding. | |
let output = vimproc#util#iconv( | |
\ output, vimproc#util#stdoutencoding(), &encoding) | |
let s:last_errmsg = vimproc#util#iconv( | |
\ s:last_errmsg, vimproc#util#stderrencoding(), &encoding) | |
return output | |
endfunction"}}} | |
1 0.000003 function! vimproc#system_passwd(cmdline, ...) "{{{ | |
if type(a:cmdline) == type('') | |
let args = vimproc#parser#parse_pipe(a:cmdline) | |
else | |
let args = [{ 'fd' : { 'stdin' : '', 'stdout' : '', 'stderr' : '' }, | |
\ 'args' : a:cmdline }] | |
endif | |
let timeout = a:0 >= 2 ? a:2 : 0 | |
let input = a:0 >= 1 ? a:1 : '' | |
let lang_save = $LANG | |
try | |
let $LANG = 'C' | |
return s:system(args, 1, input, timeout, 1) | |
finally | |
let $LANG = lang_save | |
endtry | |
endfunction"}}} | |
1 0.000002 function! vimproc#system_bg(cmdline) "{{{ | |
" Open pipe. | |
let subproc = vimproc#popen3(a:cmdline) | |
if empty(subproc) | |
" Not supported path error. | |
return '' | |
endif | |
" Close handles. | |
call s:close_all(subproc) | |
let s:bg_processes[subproc.pid] = subproc.pid | |
return '' | |
endfunction"}}} | |
1 0.000002 function! vimproc#system_gui(cmdline) "{{{ | |
if vimproc#util#is_windows() | |
silent execute ':!start ' . join(map(vimproc#parser#split_args(a:cmdline), '"\"".v:val."\""')) | |
return '' | |
else | |
return vimproc#system_bg(a:cmdline) | |
endif | |
endfunction"}}} | |
1 0.000003 function! vimproc#get_last_status() "{{{ | |
return s:last_status | |
endfunction"}}} | |
1 0.000002 function! vimproc#get_last_errmsg() "{{{ | |
return substitute(vimproc#util#iconv(s:last_errmsg, | |
\ vimproc#util#stderrencoding(), &encoding), '\n$', '', '') | |
endfunction"}}} | |
1 0.000002 function! vimproc#shellescape(string) "{{{ | |
return string(a:string) | |
endfunction"}}} | |
1 0.000003 function! vimproc#fopen(path, flags, ...) "{{{ | |
let mode = get(a:000, 0, 0644) | |
let fd = s:vp_file_open(a:path, a:flags, mode) | |
let proc = s:fdopen(fd, 'vp_file_close', 'vp_file_read', 'vp_file_write') | |
return proc | |
endfunction"}}} | |
1 0.000002 function! vimproc#popen2(args) "{{{ | |
let args = type(a:args) == type('') ? | |
\ vimproc#parser#split_args(a:args) : | |
\ a:args | |
return s:plineopen(2, [{ | |
\ 'args' : args, | |
\ 'fd' : { 'stdin' : '', 'stdout' : '', 'stderr' : '' }, | |
\ }], 0) | |
endfunction"}}} | |
1 0.000002 function! vimproc#popen3(args) "{{{ | |
let args = type(a:args) == type('') ? | |
\ vimproc#parser#split_args(a:args) : | |
\ a:args | |
return s:plineopen(3, [{ | |
\ 'args' : args, | |
\ 'fd' : { 'stdin' : '', 'stdout' : '', 'stderr' : '' }, | |
\ }], 0) | |
endfunction"}}} | |
1 0.000003 function! vimproc#plineopen2(commands, ...) "{{{ | |
let commands = type(a:commands) == type('') ? | |
\ vimproc#parser#parse_pipe(a:commands) : | |
\ a:commands | |
let is_pty = get(a:000, 0, 0) | |
return s:plineopen(2, commands, is_pty) | |
endfunction"}}} | |
1 0.000002 function! vimproc#plineopen3(commands, ...) "{{{ | |
let commands = type(a:commands) == type('') ? | |
\ vimproc#parser#parse_pipe(a:commands) : | |
\ a:commands | |
let is_pty = get(a:000, 0, 0) | |
return s:plineopen(3, commands, is_pty) | |
endfunction"}}} | |
1 0.000003 function! s:plineopen(npipe, commands, is_pty) "{{{ | |
let pid_list = [] | |
let stdin_list = [] | |
let stdout_list = [] | |
let stderr_list = [] | |
let npipe = a:npipe | |
" Open input. | |
let hstdin = (empty(a:commands) || a:commands[0].fd.stdin == '')? | |
\ 0 : vimproc#fopen(a:commands[0].fd.stdin, 'O_RDONLY').fd | |
let is_pty = !vimproc#util#is_windows() && a:is_pty | |
let cnt = 0 | |
for command in a:commands | |
if is_pty && command.fd.stdout == '' && cnt == 0 | |
\ && len(a:commands) != 1 | |
" pty_open() use pipe. | |
let hstdout = 1 | |
else | |
let mode = 'O_WRONLY | O_CREAT' | |
if command.fd.stdout =~ '^>' | |
let mode .= ' | O_APPEND' | |
let command.fd.stdout = command.fd.stdout[1:] | |
else | |
let mode .= ' | O_TRUNC' | |
endif | |
let hstdout = s:is_pseudo_device(command.fd.stdout) ? | |
\ 0 : vimproc#fopen(command.fd.stdout, mode).fd | |
endif | |
if is_pty && command.fd.stderr == '' && cnt == 0 | |
\ && len(a:commands) != 1 | |
" pty_open() use pipe. | |
let hstderr = 1 | |
else | |
let mode = 'O_WRONLY | O_CREAT' | |
if command.fd.stderr =~ '^>' | |
let mode .= ' | O_APPEND' | |
let command.fd.stderr = command.fd.stderr[1:] | |
else | |
let mode .= ' | O_TRUNC' | |
endif | |
let hstderr = s:is_pseudo_device(command.fd.stderr) ? | |
\ 0 : vimproc#fopen(command.fd.stderr, mode).fd | |
endif | |
if command.fd.stderr ==# '/dev/stdout' | |
let npipe = 2 | |
endif | |
let args = s:convert_args(command.args) | |
let command_name = fnamemodify(args[0], ':t:r') | |
let pty_npipe = cnt == 0 | |
\ && hstdin == 0 && hstdout == 0 && hstderr == 0 | |
\ && exists('g:vimproc_popen2_commands') | |
\ && get(g:vimproc_popen2_commands, command_name, 0) != 0 ? | |
\ 2 : npipe | |
if is_pty && (cnt == 0 || cnt == len(a:commands)-1) | |
" Use pty_open(). | |
let pipe = s:vp_pty_open(pty_npipe, winwidth(0)-5, winheight(0), | |
\ hstdin, hstdout, hstderr, args) | |
else | |
let pipe = s:vp_pipe_open(pty_npipe, | |
\ hstdin, hstdout, hstderr, args) | |
endif | |
if len(pipe) == 4 | |
let [pid, fd_stdin, fd_stdout, fd_stderr] = pipe | |
let stderr = s:fdopen(fd_stderr, | |
\ 'vp_pipe_close', 'vp_pipe_read', 'vp_pipe_write') | |
else | |
let [pid, fd_stdin, fd_stdout] = pipe | |
let stderr = s:closed_fdopen( | |
\ 'vp_pipe_close', 'vp_pipe_read', 'vp_pipe_write') | |
endif | |
call add(pid_list, pid) | |
let stdin = s:fdopen(fd_stdin, | |
\ 'vp_pipe_close', 'vp_pipe_read', 'vp_pipe_write') | |
let stdin.is_pty = is_pty | |
\ && (cnt == 0 || cnt == len(a:commands)-1) | |
\ && hstdin == 0 | |
call add(stdin_list, stdin) | |
let stdout = s:fdopen(fd_stdout, | |
\ 'vp_pipe_close', 'vp_pipe_read', 'vp_pipe_write') | |
let stdout.is_pty = is_pty | |
\ && (cnt == 0 || cnt == len(a:commands)-1) | |
\ && hstdout == 0 | |
call add(stdout_list, stdout) | |
let stderr.is_pty = is_pty | |
\ && (cnt == 0 || cnt == len(a:commands)-1) | |
\ && hstderr == 0 | |
call add(stderr_list, stderr) | |
let hstdin = stdout_list[-1].fd | |
let cnt += 1 | |
endfor | |
let proc = {} | |
let proc.pid_list = pid_list | |
let proc.pid = pid_list[-1] | |
let proc.stdin = s:fdopen_pipes(stdin_list, | |
\ 'vp_pipes_close', 'read_pipes', 'write_pipes') | |
let proc.stdout = s:fdopen_pipes(stdout_list, | |
\ 'vp_pipes_close', 'read_pipes', 'write_pipes') | |
let proc.stderr = s:fdopen_pipes(stderr_list, | |
\ 'vp_pipes_close', 'read_pipes', 'write_pipes') | |
let proc.get_winsize = s:funcref('vp_get_winsize') | |
let proc.set_winsize = s:funcref('vp_set_winsize') | |
let proc.kill = s:funcref('vp_kill') | |
let proc.waitpid = s:funcref('vp_waitpid') | |
let proc.checkpid = s:funcref('vp_checkpid') | |
let proc.is_valid = 1 | |
let proc.is_pty = is_pty | |
if a:is_pty | |
let proc.ttyname = '' | |
let proc.get_winsize = s:funcref('vp_get_winsize') | |
let proc.set_winsize = s:funcref('vp_set_winsize') | |
endif | |
return proc | |
endfunction"}}} | |
1 0.000003 function! s:is_pseudo_device(filename) "{{{ | |
if vimproc#util#is_windows() && ( | |
\ a:filename ==# '/dev/stdin' | |
\ || a:filename ==# '/dev/stdout' | |
\ || a:filename ==# '/dev/stderr') | |
return 1 | |
endif | |
return a:filename == '' | |
\ || a:filename ==# '/dev/null' | |
\ || a:filename ==# '/dev/clip' | |
\ || a:filename ==# '/dev/quickfix' | |
endfunction"}}} | |
1 0.000003 function! vimproc#pgroup_open(statements, ...) "{{{ | |
if type(a:statements) == type('') | |
let statements = | |
\ vimproc#parser#parse_statements(a:statements) | |
for statement in statements | |
let statement.statement = | |
\ vimproc#parser#parse_pipe(statement.statement) | |
endfor | |
else | |
let statements = a:statements | |
endif | |
let is_pty = get(a:000, 0, 0) | |
let npipe = get(a:000, 1, 3) | |
return s:pgroup_open(statements, is_pty && !vimproc#util#is_windows(), npipe) | |
endfunction"}}} | |
1 0.000003 function! s:pgroup_open(statements, is_pty, npipe) "{{{ | |
let proc = {} | |
let proc.current_proc = | |
\ vimproc#plineopen{a:npipe}(a:statements[0].statement, a:is_pty) | |
let proc.pid = proc.current_proc.pid | |
let proc.pid_list = proc.current_proc.pid_list | |
let proc.condition = a:statements[0].condition | |
let proc.statements = a:statements[1:] | |
let proc.stdin = s:fdopen_pgroup(proc, proc.current_proc.stdin, | |
\ 'vp_pgroup_close', 'read_pgroup', 'write_pgroup') | |
let proc.stdout = s:fdopen_pgroup(proc, proc.current_proc.stdout, | |
\ 'vp_pgroup_close', 'read_pgroup', 'write_pgroup') | |
let proc.stderr = s:fdopen_pgroup(proc, proc.current_proc.stderr, | |
\ 'vp_pgroup_close', 'read_pgroup', 'write_pgroup') | |
let proc.kill = s:funcref('vp_pgroup_kill') | |
let proc.waitpid = s:funcref('vp_pgroup_waitpid') | |
let proc.is_valid = 1 | |
let proc.is_pty = 0 | |
" echomsg expand('<sfile>') | |
" echomsg 'open:' string(map(copy(proc.current_proc.stdin.fd), 'v:val.fd')) | |
" echomsg 'open:' string(map(copy(proc.current_proc.stdout.fd), 'v:val.fd')) | |
" echomsg 'open:' string(map(copy(proc.current_proc.stderr.fd), 'v:val.fd')) | |
return proc | |
endfunction"}}} | |
1 0.000003 function! vimproc#ptyopen(commands, ...) "{{{ | |
let commands = type(a:commands) == type('') ? | |
\ vimproc#parser#parse_pipe(a:commands) : | |
\ a:commands | |
let npipe = get(a:000, 0, 3) | |
return s:plineopen(npipe, commands, !vimproc#util#is_windows()) | |
endfunction"}}} | |
1 0.000003 function! vimproc#socket_open(host, port) "{{{ | |
let fd = s:vp_socket_open(a:host, a:port) | |
return s:fdopen(fd, 'vp_socket_close', 'vp_socket_read', 'vp_socket_write') | |
endfunction"}}} | |
1 0.000002 function! vimproc#host_exists(host) "{{{ | |
let rval = s:vp_host_exists( | |
\ substitute(substitute(a:host, '^\a\+://', '', ''), '/.*$', '', '')) | |
return 0 + rval | |
endfunction"}}} | |
1 0.000002 function! vimproc#kill(pid, sig) "{{{ | |
if a:sig == 0 && vimproc#util#is_windows() | |
" Use waitpid(). | |
let [cond, status] = s:waitpid(a:pid) | |
return cond ==# 'run' | |
endif | |
try | |
let [ret] = s:libcall('vp_kill', [a:pid, a:sig]) | |
catch /kill() error:/ | |
let s:last_errmsg = v:exception | |
return 1 | |
endtry | |
return ret | |
endfunction"}}} | |
1 0.000003 function! vimproc#decode_signal(signal) "{{{ | |
if a:signal == 2 | |
return 'SIGINT' | |
elseif a:signal == 3 | |
return 'SIGQUIT' | |
elseif a:signal == 4 | |
return 'SIGILL' | |
elseif a:signal == 6 | |
return 'SIGABRT' | |
elseif a:signal == 8 | |
return 'SIGFPE' | |
elseif a:signal == 9 | |
return 'SIGKILL' | |
elseif a:signal == 11 | |
return 'SIGSEGV' | |
elseif a:signal == 13 | |
return 'SIGPIPE' | |
elseif a:signal == 14 | |
return 'SIGALRM' | |
elseif a:signal == 15 | |
return 'SIGTERM' | |
elseif a:signal == 10 | |
return 'SIGUSR1' | |
elseif a:signal == 12 | |
return 'SIGUSR2' | |
elseif a:signal == 17 | |
return 'SIGCHLD' | |
elseif a:signal == 18 | |
return 'SIGCONT' | |
elseif a:signal == 19 | |
return 'SIGSTOP' | |
elseif a:signal == 20 | |
return 'SIGTSTP' | |
elseif a:signal == 21 | |
return 'SIGTTIN' | |
elseif a:signal == 22 | |
return 'SIGTTOU' | |
else | |
return 'UNKNOWN' | |
endif | |
endfunction"}}} | |
1 0.000003 function! vimproc#write(filename, string, ...) "{{{ | |
if a:string == '' | |
return | |
endif | |
let mode = get(a:000, 0, | |
\ a:filename =~ '^>' ? 'a' : 'w') | |
let filename = a:filename =~ '^>' ? | |
\ a:filename[1:] : a:filename | |
if filename ==# '/dev/null' | |
" Nothing. | |
elseif filename ==# '/dev/clip' | |
" Write to clipboard. | |
if mode =~ 'a' | |
let @+ .= a:string | |
else | |
let @+ = a:string | |
endif | |
elseif filename ==# '/dev/quickfix' | |
" Write to quickfix. | |
let qflist = getqflist() | |
for str in split(a:string, '\n\|\r\n') | |
if str =~ '^.\+:.\+:.\+$' | |
let line = split(str[2:], ':') | |
let filename = str[:1] . line[0] | |
if len(line) >= 3 && line[1] =~ '^\d\+$' | |
call add(qflist, { | |
\ 'filename' : filename, | |
\ 'lnum' : line[1], | |
\ 'text' : join(line[2:], ':'), | |
\ }) | |
else | |
call add(qflist, { | |
\ 'text' : str, | |
\ }) | |
endif | |
endif | |
endfor | |
call setqflist(qflist) | |
else | |
" Write file. | |
let mode = 'O_WRONLY | O_CREAT' | |
if mode =~ 'a' | |
" Append mode. | |
let mode .= '| O_APPEND' | |
endif | |
let hfile = vimproc#fopen(filename, mode) | |
call hfile.write(a:string) | |
call hfile.close() | |
endif | |
endfunction"}}} | |
1 0.000003 function! vimproc#readdir(dirname) "{{{ | |
let dirname = substitute(substitute( | |
\ vimproc#util#expand(a:dirname), | |
\ '\\', '/', 'g'), '/$', '', '') | |
if dirname == '' | |
let dirname = getcwd() | |
endif | |
if !isdirectory(dirname) | |
return [] | |
endif | |
let dirname = vimproc#util#iconv(dirname, &encoding, | |
\ vimproc#util#termencoding()) | |
try | |
let files = s:libcall('vp_readdir', [dirname]) | |
catch /vp_readdir/ | |
return [] | |
endtry | |
call map(files, 'vimproc#util#iconv( | |
\ v:val, vimproc#util#termencoding(), &encoding)') | |
if vimproc#util#is_windows() | |
call map(files, 'vimproc#util#substitute_path_separator(v:val)') | |
endif | |
return files | |
endfunction"}}} | |
1 0.000003 function! vimproc#delete_trash(filename) "{{{ | |
if !vimproc#util#is_windows() | |
call s:print_error('Not implemented in this platform.') | |
return | |
endif | |
let filename = a:filename | |
if !filewritable(filename) && !isdirectory(filename) | |
return 1 | |
endif | |
" Substitute path separator to "/". | |
let filename = substitute( | |
\ fnamemodify(filename, ':p'), '/', '\\', 'g') | |
" Delete last /. | |
if filename =~ '[^:][/\\]$' | |
" Delete last /. | |
let filename = filename[: -2] | |
endif | |
" Encoding conversion. | |
let filename = vimproc#util#iconv(filename, | |
\ &encoding, vimproc#util#termencoding()) | |
let [ret] = s:libcall('vp_delete_trash', [filename]) | |
return str2nr(ret) | |
endfunction"}}} | |
1 0.000003 function! vimproc#test_readdir(dirname) "{{{ | |
let start = reltime() | |
call split(glob(a:dirname.'/*'), '\n') | |
echomsg reltimestr(reltime(start)) | |
let start = reltime() | |
call vimproc#readdir(a:dirname) | |
echomsg reltimestr(reltime(start)) | |
endfunction"}}} | |
1 0.000003 function! s:close_all(self) "{{{ | |
if has_key(a:self, 'stdin') | |
call a:self.stdin.close() | |
endif | |
if has_key(a:self, 'stdout') | |
call a:self.stdout.close() | |
endif | |
if has_key(a:self, 'stderr') | |
call a:self.stderr.close() | |
endif | |
endfunction"}}} | |
1 0.000002 function! s:close() dict "{{{ | |
if self.is_valid | |
call self.f_close() | |
endif | |
let self.is_valid = 0 | |
let self.eof = 1 | |
let self.__eof = 1 | |
endfunction"}}} | |
1 0.000003 function! s:read(...) dict "{{{ | |
if self.__eof | |
let self.eof = 1 | |
return '' | |
endif | |
let number = get(a:000, 0, -1) | |
let timeout = get(a:000, 1, s:read_timeout) | |
let [hd, eof] = self.f_read(number, timeout) | |
let self.eof = eof | |
let self.__eof = eof | |
if hd == '' | |
return '' | |
endif | |
" Note: if output string is too long, if_lua is too slow. | |
return (vimproc#util#has_lua() && len(hd) < 1024) ? | |
\ s:hd2str_lua([hd]) : s:hd2str([hd]) | |
" return s:hd2str([hd]) | |
endfunction"}}} | |
1 0.000002 function! s:read_lines(...) dict "{{{ | |
let res = self.buffer | |
while !self.eof && stridx(res, "\n") < 0 | |
let out = call(self.read, a:000, self) | |
if out == '' | |
break | |
endif | |
let res .= out | |
endwhile | |
let lines = split(res, '\r\?\n', 1) | |
if self.eof | |
let self.buffer = '' | |
return lines | |
else | |
let self.buffer = empty(lines)? '' : lines[-1] | |
let lines = lines[ : -2] | |
endif | |
let self.eof = (self.buffer != '') ? 0 : self.__eof | |
return lines | |
endfunction"}}} | |
1 0.000002 function! s:read_line(...) dict "{{{ | |
let lines = call(self.read_lines, a:000, self) | |
let self.buffer = join(lines[1:], "\n") . self.buffer | |
let self.eof = (self.buffer != '') ? 0 : self.__eof | |
return get(lines, 0, '') | |
endfunction"}}} | |
1 0.000002 function! s:write(str, ...) dict "{{{ | |
let timeout = get(a:000, 0, s:write_timeout) | |
let hd = s:str2hd(a:str) | |
return self.f_write(hd, timeout) | |
endfunction"}}} | |
1 0.000003 function! s:fdopen(fd, f_close, f_read, f_write) "{{{ | |
return { | |
\ 'fd' : a:fd, | |
\ 'eof' : 0, '__eof' : 0, 'is_valid' : 1, 'buffer' : '', | |
\ 'f_close' : s:funcref(a:f_close), 'f_read' : s:funcref(a:f_read), 'f_write' : s:funcref(a:f_write), | |
\ 'close' : s:funcref('close'), 'read' : s:funcref('read'), 'write' : s:funcref('write'), | |
\ 'read_line' : s:funcref('read_line'), 'read_lines' : s:funcref('read_lines'), | |
\} | |
endfunction"}}} | |
1 0.000002 function! s:closed_fdopen(f_close, f_read, f_write) "{{{ | |
return { | |
\ 'fd' : -1, | |
\ 'eof' : 1, '__eof' : 1, 'is_valid' : 0, 'buffer' : '', | |
\ 'f_close' : s:funcref(a:f_close), 'f_read' : s:funcref(a:f_read), 'f_write' : s:funcref(a:f_write), | |
\ 'close' : s:funcref('close'), 'read' : s:funcref('read'), 'write' : s:funcref('write'), | |
\ 'read_line' : s:funcref('read_line'), 'read_lines' : s:funcref('read_lines'), | |
\} | |
endfunction"}}} | |
1 0.000003 function! s:fdopen_pty(fd_stdin, fd_stdout, f_close, f_read, f_write) "{{{ | |
return { | |
\ 'eof' : 0, '__eof' : 0, 'is_valid' : 1, 'buffer' : '', | |
\ 'fd_stdin' : a:fd_stdin, 'fd_stdout' : a:fd_stdout, | |
\ 'f_close' : s:funcref(a:f_close), 'f_read' : s:funcref(a:f_read), 'f_write' : s:funcref(a:f_write), | |
\ 'close' : s:funcref('close'), 'read' : s:funcref('read'), 'write' : s:funcref('write'), | |
\ 'read_line' : s:funcref('read_line'), 'read_lines' : s:funcref('read_lines'), | |
\} | |
endfunction"}}} | |
1 0.000003 function! s:fdopen_pipes(fd, f_close, f_read, f_write) "{{{ | |
return { | |
\ 'eof' : 0, '__eof' : 0, 'is_valid' : 1, 'buffer' : '', | |
\ 'fd' : a:fd, | |
\ 'f_close' : s:funcref(a:f_close), | |
\ 'close' : s:funcref('close'), 'read' : s:funcref(a:f_read), 'write' : s:funcref(a:f_write), | |
\ 'read_line' : s:funcref('read_line'), 'read_lines' : s:funcref('read_lines'), | |
\} | |
endfunction"}}} | |
1 0.000003 function! s:fdopen_pgroup(proc, fd, f_close, f_read, f_write) "{{{ | |
return { | |
\ 'eof' : 0, '__eof' : 0, 'is_valid' : 1, 'buffer' : '', | |
\ 'proc' : a:proc, 'fd' : a:fd, | |
\ 'f_close' : s:funcref(a:f_close), | |
\ 'close' : s:funcref('close'), 'read' : s:funcref(a:f_read), 'write' : s:funcref(a:f_write), | |
\ 'read_line' : s:funcref('read_line'), 'read_lines' : s:funcref('read_lines'), | |
\} | |
endfunction"}}} | |
1 0.000005 function! s:garbage_collect(is_force) "{{{ | |
for pid in values(s:bg_processes) | |
" Check processes. | |
try | |
let [cond, status] = s:libcall('vp_waitpid', [pid]) | |
" echomsg string([pid, cond, status]) | |
if cond !=# 'run' || a:is_force | |
if cond !=# 'exit' | |
" Kill process. | |
" 15 == SIGTERM | |
call vimproc#kill(pid, 15) | |
endif | |
if vimproc#util#is_windows() | |
call s:libcall('vp_close_handle', [pid]) | |
endif | |
call remove(s:bg_processes, pid) | |
endif | |
catch | |
" Ignore error. | |
endtry | |
endfor | |
endfunction"}}} | |
"----------------------------------------------------------- | |
" UTILS | |
1 0.000003 function! s:str2hd(str) | |
return join(map(range(len(a:str)), | |
\ 'printf("%02X", char2nr(a:str[v:val]))'), '') | |
endfunction | |
1 0.000006 function! s:hd2str(hd) | |
" a:hd is a list because to avoid copying the value. | |
return get(s:libcall('vp_decode', [a:hd[0]]), 0, '') | |
endfunction | |
1 0.000002 function! s:hd2str_lua(hd) | |
let ret = [] | |
lua << EOF | |
do | |
local ret = vim.eval('ret') | |
local hd = vim.eval('a:hd') | |
if hd[0] == nil then | |
hd[0] = '' | |
end | |
local len = string.len(hd[0]) | |
local s = '' | |
for i = 1, len, 2 do | |
s = s .. string.char(tonumber(string.sub(hd[0], i, i+1), 16)) | |
end | |
ret:add(s) | |
end | |
EOF | |
return ret[0] | |
endfunction | |
1 0.000002 function! s:str2list(str) | |
return map(range(len(a:str)), 'char2nr(a:str[v:val])') | |
endfunction | |
1 0.000001 function! s:list2str(lis) | |
return s:hd2str(s:list2hd([a:lis])) | |
endfunction | |
1 0.000002 function! s:hd2list(hd) | |
return map(split(a:hd, '..\zs'), 'str2nr(v:val, 16)') | |
endfunction | |
1 0.000002 function! s:list2hd(lis) | |
return join(map(a:lis, 'printf("%02X", v:val)'), '') | |
endfunction | |
1 0.000003 function! s:convert_args(args) "{{{ | |
if empty(a:args) | |
return [] | |
endif | |
if vimproc#util#is_windows() && !executable(a:args[0]) | |
" Search from internal commands. | |
let internal_commands = [ | |
\ 'copy', 'dir', 'echo', 'erase', 'ftype', | |
\ 'md', 'mkdir', 'move', 'path', 'rd', 'ren', 'rename', | |
\ 'rmdir', 'start', 'time', 'type', 'ver', 'vol'] | |
let index = index(internal_commands, a:args[0]) | |
if index >= 0 | |
" Use cmd.exe | |
return ['cmd', '/c', internal_commands[index]] + a:args[1:] | |
endif | |
endif | |
let command_name = vimproc#get_command_name(a:args[0]) | |
return vimproc#analyze_shebang(command_name) + a:args[1:] | |
endfunction"}}} | |
1 0.000003 function! vimproc#analyze_shebang(filename) "{{{ | |
if !filereadable(a:filename) || | |
\ getfsize(a:filename) > 100000 || | |
\ (vimproc#util#is_windows() && | |
\ '.'.fnamemodify(a:filename, ':e') !~? | |
\ '^'.substitute($PATHEXT, ';', '$\\|^', 'g').'$') | |
" Maybe a binary file. | |
return [a:filename] | |
endif | |
let lines = readfile(a:filename, '', 1) | |
if empty(lines) || lines[0] !~ '^#!.\+' | |
" Shebang not found. | |
return [a:filename] | |
endif | |
" Get shebang line. | |
let shebang = split(matchstr(lines[0], '^#!\zs.\+')) | |
" Convert command name. | |
if vimproc#util#is_windows() | |
\ && shebang[0] =~ '^/' | |
let shebang[0] = vimproc#get_command_name( | |
\ fnamemodify(shebang[0], ':t')) | |
endif | |
return shebang + [a:filename] | |
endfunction"}}} | |
"----------------------------------------------------------- | |
" LOW LEVEL API | |
1 0.000004 augroup vimproc | |
1 0.000008 autocmd VimLeave * call s:finalize() | |
1 0.000007 autocmd CursorHold,BufWritePost * call s:garbage_collect(0) | |
1 0.000001 augroup END | |
" Initialize. | |
1 0.000003 let s:lasterr = [] | |
1 0.000002 let s:read_timeout = 100 | |
1 0.000002 let s:write_timeout = 100 | |
1 0.000002 let s:bg_processes = {} | |
1 0.000002 function! s:split(str, sep) | |
let [result, pos] = [[], 0] | |
while 1 | |
let tmp = stridx(a:str, a:sep, pos) | |
if tmp == -1 | |
call add(result, strpart(a:str, pos)) | |
break | |
endif | |
call add(result, strpart(a:str, pos, tmp - pos)) | |
let pos = tmp + 1 | |
endwhile | |
return result | |
endfunction | |
1 0.000003 function! s:split_lua(str, sep) | |
let result = [] | |
lua << EOF | |
do | |
local pos = 1 | |
local result = vim.eval('result') | |
local str = vim.eval('a:str') | |
local sep = vim.eval('a:sep') | |
local tmp = string.find(str, sep, pos, true) | |
while tmp ~= nil do | |
result:add(string.sub(str, pos, tmp-1)) | |
pos = tmp + 1 | |
tmp = string.find(str, sep, pos, true) | |
end | |
result:add(string.sub(str, pos)) | |
end | |
EOF | |
return result | |
endfunction | |
1 0.000003 function! s:libcall(func, args) "{{{ | |
" End Of Value | |
let EOV = "\xFF" | |
let args = empty(a:args) ? '' : (join(reverse(copy(a:args)), EOV) . EOV) | |
let stack_buf = libcall(g:vimproc#dll_path, a:func, args) | |
let result = vimproc#util#has_lua() ? | |
\ s:split_lua(stack_buf, EOV) : s:split(stack_buf, EOV) | |
if !empty(result) && result[-1] != '' | |
if stack_buf[len(stack_buf) - 1] ==# EOV | |
" Note: If &encoding equals "cp932" and output ends multibyte first byte, | |
" will fail split. | |
return result | |
endif | |
let s:lasterr = result | |
let msg = vimproc#util#iconv(string(result), | |
\ vimproc#util#termencoding(), &encoding) | |
throw printf('vimproc: %s: %s', a:func, msg) | |
endif | |
return result[:-2] | |
endfunction"}}} | |
1 0.000003 function! s:SID_PREFIX() | |
if !exists('s:sid_prefix') | |
let s:sid_prefix = matchstr(expand('<sfile>'), | |
\ '<SNR>\d\+_\zeSID_PREFIX$') | |
endif | |
return s:sid_prefix | |
endfunction | |
" Get funcref. | |
1 0.000002 function! s:funcref(funcname) | |
return function(s:SID_PREFIX().a:funcname) | |
endfunction | |
1 0.000003 function! s:finalize() | |
call s:garbage_collect(1) | |
if exists('s:dll_handle') | |
call s:vp_dlclose(s:dll_handle) | |
endif | |
endfunction | |
1 0.000003 function! s:vp_dlopen(path) | |
let [handle] = s:libcall('vp_dlopen', [a:path]) | |
return handle | |
endfunction | |
1 0.000003 function! s:vp_dlclose(handle) | |
call s:libcall('vp_dlclose', [a:handle]) | |
endfunction | |
1 0.000002 function! s:vp_file_open(path, flags, mode) | |
let [fd] = s:libcall('vp_file_open', [a:path, a:flags, a:mode]) | |
return fd | |
endfunction | |
1 0.000002 function! s:vp_file_close() dict | |
if self.fd != 0 | |
call s:libcall('vp_file_close', [self.fd]) | |
let self.fd = 0 | |
endif | |
endfunction | |
1 0.000002 function! s:vp_file_read(number, timeout) dict | |
let [hd, eof] = s:libcall('vp_file_read', [self.fd, a:number, a:timeout]) | |
return [hd, eof] | |
endfunction | |
1 0.000002 function! s:vp_file_write(hd, timeout) dict | |
let [nleft] = s:libcall('vp_file_write', [self.fd, a:hd, a:timeout]) | |
return nleft | |
endfunction | |
1 0.000002 function! s:quote_arg(arg) | |
return a:arg =~ '[ "]' ? '"' . substitute(a:arg, '"', '\\"', 'g') . '"' : a:arg | |
endfunction | |
1 0.000006 function! s:vp_pipe_open(npipe, hstdin, hstdout, hstderr, argv) "{{{ | |
if vimproc#util#is_windows() | |
let cmdline = s:quote_arg(substitute(a:argv[0], '/', '\', 'g')) | |
for arg in a:argv[1:] | |
let cmdline .= ' ' . s:quote_arg(arg) | |
endfor | |
let [pid; fdlist] = s:libcall('vp_pipe_open', | |
\ [a:npipe, a:hstdin, a:hstdout, a:hstderr, cmdline]) | |
else | |
let [pid; fdlist] = s:libcall('vp_pipe_open', | |
\ [a:npipe, a:hstdin, a:hstdout, a:hstderr, len(a:argv)] + a:argv) | |
endif | |
if a:npipe != len(fdlist) | |
call s:print_error(printf('a:npipe = %d, a:argv = %s', a:npipe, string(a:argv))) | |
call s:print_error(printf('fdlist = %s', string(fdlist))) | |
echoerr 'Bug behavior is detected!: ' . pid | |
endif | |
return [pid] + fdlist | |
endfunction"}}} | |
1 0.000002 function! s:vp_pipe_close() dict | |
" echomsg 'close:'.self.fd | |
if self.fd != 0 | |
call s:libcall('vp_pipe_close', [self.fd]) | |
let self.fd = 0 | |
endif | |
endfunction | |
1 0.000001 function! s:vp_pipes_close() dict | |
for fd in self.fd | |
try | |
call fd.close() | |
catch /vimproc: vp_pipe_close: / | |
" Ignore error. | |
endtry | |
endfor | |
endfunction | |
1 0.000002 function! s:vp_pgroup_close() dict | |
call self.fd.close() | |
endfunction | |
1 0.000002 function! s:vp_pipe_read(number, timeout) dict | |
if self.fd == 0 | |
return ['', 1] | |
endif | |
let [hd, eof] = s:libcall('vp_pipe_read', [self.fd, a:number, a:timeout]) | |
return [hd, eof] | |
endfunction | |
1 0.000002 function! s:vp_pipe_write(hd, timeout) dict | |
if self.fd == 0 | |
return 0 | |
endif | |
let [nleft] = s:libcall('vp_pipe_write', [self.fd, a:hd, a:timeout]) | |
return nleft | |
endfunction | |
1 0.000002 function! s:read_pipes(...) dict "{{{ | |
if type(self.fd[-1]) != type({}) | |
let self.eof = 1 | |
return '' | |
endif | |
let number = get(a:000, 0, -1) | |
let timeout = get(a:000, 1, s:read_timeout) | |
let output = self.fd[-1].read(number, timeout) | |
let self.eof = self.fd[-1].eof | |
return output | |
endfunction"}}} | |
1 0.000002 function! s:write_pipes(str, ...) dict "{{{ | |
let timeout = get(a:000, 0, s:write_timeout) | |
if self.fd[0].eof | |
return 0 | |
endif | |
" Write data. | |
let nleft = self.fd[0].write(a:str, timeout) | |
let self.eof = self.fd[0].eof | |
return nleft | |
endfunction"}}} | |
1 0.000003 function! s:read_pgroup(...) dict "{{{ | |
let number = get(a:000, 0, -1) | |
let timeout = get(a:000, 1, s:read_timeout) | |
let output = '' | |
if !self.fd.eof | |
let output = self.fd.read(number, timeout) | |
endif | |
if self.proc.current_proc.stdout.eof && self.proc.current_proc.stderr.eof | |
" Get status. | |
let [cond, status] = self.proc.current_proc.waitpid() | |
if empty(self.proc.statements) | |
\ || (self.proc.condition ==# 'true' && status) | |
\ || (self.proc.condition ==# 'false' && !status) | |
let self.proc.statements = [] | |
" Caching status. | |
let self.proc.cond = cond | |
let self.proc.status = status | |
else | |
" Initialize next statement. | |
let proc = vimproc#plineopen3(self.proc.statements[0].statement) | |
let self.proc.current_proc = proc | |
let self.pid = proc.pid | |
let self.pid_list = proc.pid_list | |
let self.proc.condition = self.proc.statements[0].condition | |
let self.proc.statements = self.proc.statements[1:] | |
let self.proc.stdin = s:fdopen_pgroup(self.proc, proc.stdin, 'vp_pgroup_close', 'read_pgroup', 'write_pgroup') | |
let self.proc.stdout = s:fdopen_pgroup(self.proc, proc.stdout, 'vp_pgroup_close', 'read_pgroup', 'write_pgroup') | |
let self.proc.stderr = s:fdopen_pgroup(self.proc, proc.stderr, 'vp_pgroup_close', 'read_pgroup', 'write_pgroup') | |
endif | |
endif | |
if self.proc.current_proc.stdout.eof | |
let self.proc.stdout.eof = 1 | |
let self.proc.stdout.__eof = 1 | |
endif | |
if self.proc.current_proc.stderr.eof | |
let self.proc.stderr.eof = 1 | |
let self.proc.stderr.__eof = 1 | |
endif | |
return output | |
endfunction"}}} | |
1 0.000002 function! s:write_pgroup(str, ...) dict "{{{ | |
let timeout = get(a:000, 0, s:write_timeout) | |
let nleft = 0 | |
if !self.fd.eof | |
" Write data. | |
let nleft = self.fd.write(a:str, timeout) | |
endif | |
return nleft | |
endfunction"}}} | |
1 0.000004 function! s:vp_pty_open(npipe, width, height, hstdin, hstdout, hstderr, argv) | |
let [pid; fdlist] = s:libcall('vp_pty_open', | |
\ [a:npipe, a:width, a:height, | |
\ a:hstdin, a:hstdout, a:hstderr, len(a:argv)] + a:argv) | |
return [pid] + fdlist | |
endfunction | |
1 0.000002 function! s:vp_pty_close() dict | |
call s:libcall('vp_pty_close', [self.fd]) | |
endfunction | |
1 0.000002 function! s:vp_pty_read(number, timeout) dict | |
let [hd, eof] = s:libcall('vp_pty_read', [self.fd, a:number, a:timeout]) | |
return [hd, eof] | |
endfunction | |
1 0.000002 function! s:vp_pty_write(hd, timeout) dict | |
let [nleft] = s:libcall('vp_pty_write', [self.fd, a:hd, a:timeout]) | |
return nleft | |
endfunction | |
1 0.000002 function! s:vp_get_winsize() dict | |
if self.is_pty && vimproc#util#is_windows() | |
return [winwidth(0)-5, winheight(0)] | |
endif | |
for pid in self.pid_list | |
let [width, height] = s:libcall('vp_pty_get_winsize', [pid]) | |
endfor | |
return [width, height] | |
endfunction | |
1 0.000002 function! s:vp_set_winsize(width, height) dict | |
if vimproc#util#is_windows() || !self.is_valid | |
" Not implemented. | |
return | |
endif | |
if self.is_pty | |
if self.stdin.eof == 0 && self.stdin.fd[-1].is_pty | |
call s:libcall('vp_pty_set_winsize', | |
\ [self.stdin.fd[-1].fd, a:width-5, a:height]) | |
endif | |
if self.stdout.eof == 0 && self.stdout.fd[0].is_pty | |
call s:libcall('vp_pty_set_winsize', | |
\ [self.stdout.fd[0].fd, a:width-5, a:height]) | |
endif | |
if self.stderr.eof == 0 && self.stderr.fd[0].is_pty | |
call s:libcall('vp_pty_set_winsize', | |
\ [self.stderr.fd[0].fd, a:width-5, a:height]) | |
endif | |
endif | |
" Send SIGWINCH = 28 signal. | |
for pid in self.pid_list | |
call vimproc#kill(pid, 28) | |
endfor | |
endfunction | |
1 0.000003 function! s:vp_kill(sig) dict | |
if a:sig != 0 | |
call s:close_all(self) | |
let self.is_valid = 0 | |
endif | |
let ret = 0 | |
for pid in get(self, 'pid_list', [self.pid]) | |
let ret = vimproc#kill(pid, a:sig) | |
endfor | |
return ret | |
endfunction | |
1 0.000003 function! s:vp_pgroup_kill(sig) dict | |
if a:sig != 0 | |
call s:close_all(self) | |
let self.is_valid = 0 | |
endif | |
if self.pid == 0 | |
" Ignore. | |
return | |
endif | |
return self.current_proc.kill(a:sig) | |
endfunction | |
1 0.000003 function! s:waitpid(pid) | |
try | |
let [cond, status] = s:libcall('vp_waitpid', [a:pid]) | |
" echomsg string([cond, status]) | |
if cond ==# 'run' | |
" Add process list. | |
let s:bg_processes[a:pid] = a:pid | |
let [cond, status] = ['exit', '0'] | |
elseif vimproc#util#is_windows() | |
call s:libcall('vp_close_handle', [a:pid]) | |
endif | |
let s:last_status = status | |
catch | |
let [cond, status] = ['error', '0'] | |
endtry | |
return [cond, str2nr(status)] | |
endfunction | |
1 0.000003 function! s:vp_checkpid() dict | |
try | |
let [cond, status] = s:libcall('vp_waitpid', [self.pid]) | |
if cond !=# 'run' | |
let [self.cond, self.status] = [cond, status] | |
endif | |
catch /waitpid() error:\|vp_waitpid:/ | |
let [cond, status] = ['error', '0'] | |
endtry | |
return [cond, str2nr(status)] | |
endfunction | |
1 0.000001 function! s:vp_waitpid() dict | |
call s:close_all(self) | |
let self.is_valid = 0 | |
if has_key(self, 'cond') && has_key(self, 'status') | |
" Use cache. | |
let [cond, status] = [self.cond, self.status] | |
else | |
let [cond, status] = s:waitpid(self.pid) | |
endif | |
if cond ==# 'exit' | |
let self.pid = 0 | |
endif | |
if has_key(self, 'pid_list') | |
for pid in self.pid_list[: -2] | |
call s:waitpid(pid) | |
endfor | |
endif | |
return [cond, str2nr(status)] | |
endfunction | |
1 0.000003 function! s:vp_pgroup_waitpid() dict | |
call s:close_all(self) | |
let self.is_valid = 0 | |
if !has_key(self, 'cond') || | |
\ !has_key(self, 'status') | |
return s:waitpid(self.pid) | |
endif | |
return [self.cond, self.status] | |
endfunction | |
1 0.000002 function! s:vp_socket_open(host, port) | |
let [socket] = s:libcall('vp_socket_open', [a:host, a:port]) | |
return socket | |
endfunction | |
1 0.000002 function! s:vp_socket_close() dict | |
call s:libcall('vp_socket_close', [self.fd]) | |
let self.is_valid = 0 | |
endfunction | |
1 0.000002 function! s:vp_socket_read(number, timeout) dict | |
let [hd, eof] = s:libcall('vp_socket_read', | |
\ [self.fd, a:number, a:timeout]) | |
return [hd, eof] | |
endfunction | |
1 0.000002 function! s:vp_socket_write(hd, timeout) dict | |
let [nleft] = s:libcall('vp_socket_write', | |
\ [self.fd, a:hd, a:timeout]) | |
return nleft | |
endfunction | |
1 0.000002 function! s:vp_host_exists(host) | |
let [rval] = s:libcall('vp_host_exists', [a:host]) | |
return rval | |
endfunction | |
" Initialize. | |
1 0.000003 if !exists('s:dll_handle') | |
1 0.000504 0.000006 let s:dll_handle = s:vp_dlopen(g:vimproc#dll_path) | |
1 0.000002 let s:last_status = 0 | |
1 0.000002 let s:last_errmsg = '' | |
1 0.000006 endif | |
" vimproc dll version check. "{{{ | |
1 0.000001 try | |
1 0.000131 0.000005 let dll_version = vimproc#dll_version() | |
1 0.000011 0.000005 if dll_version < vimproc#version() | |
call s:print_error(printf('Your vimproc binary version is "%d",'. | |
\ ' but vimproc version is "%d".', | |
\ dll_version, vimproc#version())) | |
endif | |
1 0.000001 catch | |
call s:print_error(v:throwpoint) | |
call s:print_error(v:exception) | |
call s:print_error('Your vimproc binary is too old!') | |
call s:print_error('Please re-compile it.') | |
endtry | |
1 0.000002 unlet dll_version | |
"}}} | |
" Restore 'cpoptions' {{{ | |
1 0.000007 let &cpo = s:save_cpo | |
1 0.000001 unlet s:save_cpo | |
" }}} | |
" __END__ | |
" vim:foldmethod=marker:fen:sw=2:sts=2 | |
FUNCTION <SNR>138_close() | |
Called 13000 times | |
Total time: 1.625115 | |
Self time: 0.085664 | |
count total (s) self (s) | |
13000 0.016820 if self.is_valid | |
9000 0.583507 0.056144 call self.f_close() | |
9000 0.005724 endif | |
13000 0.018669 let self.is_valid = 0 | |
13000 0.015223 let self.eof = 1 | |
13000 0.014475 let self.__eof = 1 | |
FUNCTION <SNR>138_system() | |
Called 1000 times | |
Total time: 8.385927 | |
Self time: 0.517855 | |
count total (s) self (s) | |
1000 0.002211 if empty(a:cmdline) | |
let s:last_status = 0 | |
let s:last_errmsg = '' | |
return '' | |
endif | |
" Open pipe. | |
1000 4.044965 0.018130 let subproc = (type(a:cmdline[0]) == type('')) ? vimproc#popen3(a:cmdline) : a:is_pty ? vimproc#ptyopen(a:cmdline): vimproc#pgroup_open(a:cmdline) | |
1000 0.002347 if a:input != '' | |
" Write input. | |
call subproc.stdin.write(a:input) | |
endif | |
1000 0.002506 if a:timeout > 0 && has('reltime') && v:version >= 702 | |
let start = reltime() | |
let timeout = a:timeout | |
else | |
1000 0.001523 let timeout = 0 | |
1000 0.000694 endif | |
1000 0.001272 if !a:is_passwd | |
1000 0.335065 0.007070 call subproc.stdin.close() | |
1000 0.000668 endif | |
1000 0.001476 let output = '' | |
1000 0.002126 let s:last_errmsg = '' | |
5998 0.013756 while !subproc.stdout.eof || !subproc.stderr.eof | |
4998 0.006738 if timeout > 0 "{{{ | |
" Check timeout. | |
let end = split(reltimestr(reltime(start)))[0] * 1000 | |
if end > timeout && !subproc.stdout.eof | |
" Kill process. | |
" 15 == SIGTERM | |
try | |
call subproc.kill(15) | |
call subproc.waitpid() | |
catch | |
" Ignore error. | |
endtry | |
throw 'vimproc: vimproc#system(): Timeout.' | |
endif | |
endif"}}} | |
4998 0.006547 if !subproc.stdout.eof "{{{ | |
4998 1.994870 0.045206 let out = subproc.stdout.read(1000, 0) | |
4998 0.011664 if a:is_passwd && out =~# g:vimproc_password_pattern | |
redraw | |
echo out | |
" Password input. | |
set imsearch=0 | |
let in = vimproc#util#iconv(inputsecret('Input Secret : ')."\<NL>", &encoding, vimproc#util#termencoding()) | |
call subproc.stdin.write(in) | |
else | |
4998 0.012061 let output .= out | |
4998 0.003525 endif | |
4998 0.003393 endif"}}} | |
4998 0.007187 if !subproc.stderr.eof "{{{ | |
4358 1.505893 0.029556 let out = subproc.stderr.read(1000, 0) | |
4358 0.010239 if a:is_passwd && out =~# g:vimproc_password_pattern | |
redraw | |
echo out | |
" Password input. | |
set imsearch=0 | |
let in = vimproc#util#iconv(inputsecret('Input Secret : ') . "\<NL>", &encoding, vimproc#util#termencoding()) | |
call subproc.stdin.write(in) | |
else | |
4358 0.013153 let s:last_errmsg .= out | |
4358 0.009657 let output .= out | |
4358 0.004615 endif | |
4358 0.003129 endif"}}} | |
4998 0.004690 endwhile | |
1000 0.090939 0.005461 let [cond, status] = subproc.waitpid() | |
" Newline convert. | |
1000 0.005257 0.003494 if vimproc#util#is_mac() | |
1000 0.010556 let output = substitute(output, '\r\n\@!', '\n', 'g') | |
1000 0.002113 elseif has('win32') || has('win64') | |
let output = substitute(output, '\r\n', '\n', 'g') | |
endif | |
1000 0.004457 return output | |
FUNCTION <SNR>138_convert_args() | |
Called 1000 times | |
Total time: 1.350861 | |
Self time: 0.036948 | |
count total (s) self (s) | |
1000 0.002741 if empty(a:args) | |
return [] | |
endif | |
1000 0.005882 0.004202 if vimproc#util#is_windows() && !executable(a:args[0]) | |
" Search from internal commands. | |
let internal_commands = [ 'copy', 'dir', 'echo', 'erase', 'ftype', 'md', 'mkdir', 'move', 'path', 'rd', 'ren', 'rename', 'rmdir', 'start', 'time', 'type', 'ver', 'vol'] | |
let index = index(internal_commands, a:args[0]) | |
if index >= 0 | |
" Use cmd.exe | |
return ['cmd', '/c', internal_commands[index]] + a:args[1:] | |
endif | |
endif | |
1000 1.133814 0.006576 let command_name = vimproc#get_command_name(a:args[0]) | |
1000 0.194266 0.009271 return vimproc#analyze_shebang(command_name) + a:args[1:] | |
FUNCTION <SNR>138_closed_fdopen() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return { 'fd' : -1, 'eof' : 1, '__eof' : 1, 'is_valid' : 0, 'buffer' : '', 'f_close' : s:funcref(a:f_close), 'f_read' : s:funcref(a:f_read), 'f_write' : s:funcref(a:f_write), 'close' : s:funcref('close'), 'read' : s:funcref('read'), 'write' : s:funcref('write'), 'read_line' : s:funcref('read_line'), 'read_lines' : s:funcref('read_lines'),} | |
FUNCTION vimproc#system_bg() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
" Open pipe. | |
let subproc = vimproc#popen3(a:cmdline) | |
if empty(subproc) | |
" Not supported path error. | |
return '' | |
endif | |
" Close handles. | |
call s:close_all(subproc) | |
let s:bg_processes[subproc.pid] = subproc.pid | |
return '' | |
FUNCTION <SNR>138_vp_dlclose() | |
Called 1 time | |
Total time: 0.000211 | |
Self time: 0.000008 | |
count total (s) self (s) | |
1 0.000210 0.000007 call s:libcall('vp_dlclose', [a:handle]) | |
FUNCTION vimproc#system() | |
Called 1000 times | |
Total time: 19.942873 | |
Self time: 0.076270 | |
count total (s) self (s) | |
1000 0.003233 if type(a:cmdline) == type('') | |
1000 0.004755 if a:cmdline =~ '&\s*$' | |
let cmdline = substitute(a:cmdline, '&\s*$', '', '') | |
return vimproc#system_bg(cmdline) | |
endif | |
1000 1.761573 0.020115 let args = vimproc#parser#parse_statements(a:cmdline) | |
2000 0.002768 for arg in args | |
1000 9.748953 0.009735 let arg.statement = vimproc#parser#parse_pipe(arg.statement) | |
1000 0.000851 endfor | |
1000 0.000593 else | |
let args = [{'statement' : [{ 'fd' : { 'stdin' : '', 'stdout' : '', 'stderr' : '' }, 'args' : a:cmdline }], 'condition' : 'always' }] | |
endif | |
1000 0.002876 let timeout = get(a:000, 1, 0) | |
1000 0.002560 let input = get(a:000, 0, '') | |
1000 8.399001 0.013074 return s:system(args, 0, input, timeout, 0) | |
FUNCTION vimproc#plineopen3() | |
Called 1000 times | |
Total time: 3.529414 | |
Self time: 0.026729 | |
count total (s) self (s) | |
1000 0.004633 let commands = type(a:commands) == type('') ? vimproc#parser#parse_pipe(a:commands) : a:commands | |
1000 0.002473 let is_pty = get(a:000, 0, 0) | |
1000 3.520842 0.018157 return s:plineopen(3, commands, is_pty) | |
FUNCTION vimproc#popen2() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let args = type(a:args) == type('') ? vimproc#parser#split_args(a:args) : a:args | |
return s:plineopen(2, [{ 'args' : args, 'fd' : { 'stdin' : '', 'stdout' : '', 'stderr' : '' }, }], 0) | |
FUNCTION vimproc#popen3() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let args = type(a:args) == type('') ? vimproc#parser#split_args(a:args) : a:args | |
return s:plineopen(3, [{ 'args' : args, 'fd' : { 'stdin' : '', 'stdout' : '', 'stderr' : '' }, }], 0) | |
FUNCTION vimproc#kill() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if a:sig == 0 && vimproc#util#is_windows() | |
" Use waitpid(). | |
let [cond, status] = s:waitpid(a:pid) | |
return cond ==# 'run' | |
endif | |
try | |
let [ret] = s:libcall('vp_kill', [a:pid, a:sig]) | |
catch /kill() error:/ | |
let s:last_errmsg = v:exception | |
return 1 | |
endtry | |
return ret | |
FUNCTION <SNR>138_waitpid() | |
Called 1000 times | |
Total time: 0.156168 | |
Self time: 0.032554 | |
count total (s) self (s) | |
1000 0.001105 try | |
1000 0.129116 0.007586 let [cond, status] = s:libcall('vp_waitpid', [a:pid]) | |
" echomsg string([cond, status]) | |
1000 0.001744 if cond ==# 'run' | |
" Add process list. | |
let s:bg_processes[a:pid] = a:pid | |
let [cond, status] = ['exit', '0'] | |
elseif vimproc#util#is_windows() | |
call s:libcall('vp_close_handle', [a:pid]) | |
endif | |
1000 0.002350 let s:last_status = status | |
1000 0.000856 catch | |
let [cond, status] = ['error', '0'] | |
endtry | |
1000 0.003023 return [cond, str2nr(status)] | |
FUNCTION <SNR>138_plineopen() | |
Called 1000 times | |
Total time: 3.502685 | |
Self time: 0.496405 | |
count total (s) self (s) | |
1000 0.001687 let pid_list = [] | |
1000 0.001460 let stdin_list = [] | |
1000 0.001373 let stdout_list = [] | |
1000 0.001220 let stderr_list = [] | |
1000 0.001438 let npipe = a:npipe | |
" Open input. | |
1000 0.006181 let hstdin = (empty(a:commands) || a:commands[0].fd.stdin == '')? 0 : vimproc#fopen(a:commands[0].fd.stdin, 'O_RDONLY').fd | |
1000 0.006466 0.004548 let is_pty = !vimproc#util#is_windows() && a:is_pty | |
1000 0.001294 let cnt = 0 | |
2000 0.005335 for command in a:commands | |
1000 0.002708 if is_pty && command.fd.stdout == '' && cnt == 0 && len(a:commands) != 1 | |
" pty_open() use pipe. | |
let hstdout = 1 | |
else | |
1000 0.001809 let mode = 'O_WRONLY | O_CREAT' | |
1000 0.004435 if command.fd.stdout =~ '^>' | |
let mode .= ' | O_APPEND' | |
let command.fd.stdout = command.fd.stdout[1:] | |
else | |
1000 0.003142 let mode .= ' | O_TRUNC' | |
1000 0.000672 endif | |
1000 0.018385 0.006809 let hstdout = s:is_pseudo_device(command.fd.stdout) ? 0 : vimproc#fopen(command.fd.stdout, mode).fd | |
1000 0.000738 endif | |
1000 0.002297 if is_pty && command.fd.stderr == '' && cnt == 0 && len(a:commands) != 1 | |
" pty_open() use pipe. | |
let hstderr = 1 | |
else | |
1000 0.002097 let mode = 'O_WRONLY | O_CREAT' | |
1000 0.003234 if command.fd.stderr =~ '^>' | |
let mode .= ' | O_APPEND' | |
let command.fd.stderr = command.fd.stderr[1:] | |
else | |
1000 0.002126 let mode .= ' | O_TRUNC' | |
1000 0.000614 endif | |
1000 0.016808 0.006157 let hstderr = s:is_pseudo_device(command.fd.stderr) ? 0 : vimproc#fopen(command.fd.stderr, mode).fd | |
1000 0.000699 endif | |
1000 0.002234 if command.fd.stderr ==# '/dev/stdout' | |
let npipe = 2 | |
endif | |
1000 1.359643 0.008782 let args = s:convert_args(command.args) | |
1000 0.005240 let command_name = fnamemodify(args[0], ':t:r') | |
1000 0.007675 let pty_npipe = cnt == 0 && hstdin == 0 && hstdout == 0 && hstderr == 0 && exists('g:vimproc_popen2_commands') && get(g:vimproc_popen2_commands, command_name, 0) != 0 ? 2 : npipe | |
1000 0.002501 if is_pty && (cnt == 0 || cnt == len(a:commands)-1) | |
" Use pty_open(). | |
let pipe = s:vp_pty_open(pty_npipe, winwidth(0)-5, winheight(0), hstdin, hstdout, hstderr, args) | |
else | |
1000 0.810390 0.052735 let pipe = s:vp_pipe_open(pty_npipe, hstdin, hstdout, hstderr, args) | |
1000 0.001780 endif | |
1000 0.002746 if len(pipe) == 4 | |
1000 0.005287 let [pid, fd_stdin, fd_stdout, fd_stderr] = pipe | |
1000 0.285587 0.054072 let stderr = s:fdopen(fd_stderr, 'vp_pipe_close', 'vp_pipe_read', 'vp_pipe_write') | |
1000 0.001059 else | |
let [pid, fd_stdin, fd_stdout] = pipe | |
let stderr = s:closed_fdopen( 'vp_pipe_close', 'vp_pipe_read', 'vp_pipe_write') | |
endif | |
1000 0.011379 call add(pid_list, pid) | |
1000 0.140186 0.007018 let stdin = s:fdopen(fd_stdin, 'vp_pipe_close', 'vp_pipe_read', 'vp_pipe_write') | |
1000 0.004360 let stdin.is_pty = is_pty && (cnt == 0 || cnt == len(a:commands)-1) && hstdin == 0 | |
1000 0.006498 call add(stdin_list, stdin) | |
1000 0.136668 0.006347 let stdout = s:fdopen(fd_stdout, 'vp_pipe_close', 'vp_pipe_read', 'vp_pipe_write') | |
1000 0.003771 let stdout.is_pty = is_pty && (cnt == 0 || cnt == len(a:commands)-1) && hstdout == 0 | |
1000 0.005552 call add(stdout_list, stdout) | |
1000 0.004149 let stderr.is_pty = is_pty && (cnt == 0 || cnt == len(a:commands)-1) && hstderr == 0 | |
1000 0.004489 call add(stderr_list, stderr) | |
1000 0.005400 let hstdin = stdout_list[-1].fd | |
1000 0.003446 let cnt += 1 | |
1000 0.001120 endfor | |
1000 0.002144 let proc = {} | |
1000 0.002202 let proc.pid_list = pid_list | |
1000 0.003018 let proc.pid = pid_list[-1] | |
1000 0.110510 0.009179 let proc.stdin = s:fdopen_pipes(stdin_list, 'vp_pipes_close', 'read_pipes', 'write_pipes') | |
1000 0.108448 0.006371 let proc.stdout = s:fdopen_pipes(stdout_list, 'vp_pipes_close', 'read_pipes', 'write_pipes') | |
1000 0.115305 0.006680 let proc.stderr = s:fdopen_pipes(stderr_list, 'vp_pipes_close', 'read_pipes', 'write_pipes') | |
1000 0.019232 0.005299 let proc.get_winsize = s:funcref('vp_get_winsize') | |
1000 0.018455 0.004982 let proc.set_winsize = s:funcref('vp_set_winsize') | |
1000 0.018048 0.004678 let proc.kill = s:funcref('vp_kill') | |
1000 0.017553 0.004728 let proc.waitpid = s:funcref('vp_waitpid') | |
1000 0.017608 0.004627 let proc.checkpid = s:funcref('vp_checkpid') | |
1000 0.002014 let proc.is_valid = 1 | |
1000 0.001974 let proc.is_pty = is_pty | |
1000 0.001255 if a:is_pty | |
let proc.ttyname = '' | |
let proc.get_winsize = s:funcref('vp_get_winsize') | |
let proc.set_winsize = s:funcref('vp_set_winsize') | |
endif | |
1000 0.010006 return proc | |
FUNCTION vimproc#decode_signal() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if a:signal == 2 | |
return 'SIGINT' | |
elseif a:signal == 3 | |
return 'SIGQUIT' | |
elseif a:signal == 4 | |
return 'SIGILL' | |
elseif a:signal == 6 | |
return 'SIGABRT' | |
elseif a:signal == 8 | |
return 'SIGFPE' | |
elseif a:signal == 9 | |
return 'SIGKILL' | |
elseif a:signal == 11 | |
return 'SIGSEGV' | |
elseif a:signal == 13 | |
return 'SIGPIPE' | |
elseif a:signal == 14 | |
return 'SIGALRM' | |
elseif a:signal == 15 | |
return 'SIGTERM' | |
elseif a:signal == 10 | |
return 'SIGUSR1' | |
elseif a:signal == 12 | |
return 'SIGUSR2' | |
elseif a:signal == 17 | |
return 'SIGCHLD' | |
elseif a:signal == 18 | |
return 'SIGCONT' | |
elseif a:signal == 19 | |
return 'SIGSTOP' | |
elseif a:signal == 20 | |
return 'SIGTSTP' | |
elseif a:signal == 21 | |
return 'SIGTTIN' | |
elseif a:signal == 22 | |
return 'SIGTTOU' | |
else | |
return 'UNKNOWN' | |
endif | |
FUNCTION vimproc#pgroup_open() | |
Called 1000 times | |
Total time: 4.026835 | |
Self time: 0.031042 | |
count total (s) self (s) | |
1000 0.002743 if type(a:statements) == type('') | |
let statements = vimproc#parser#parse_statements(a:statements) | |
for statement in statements | |
let statement.statement = vimproc#parser#parse_pipe(statement.statement) | |
endfor | |
else | |
1000 0.001970 let statements = a:statements | |
1000 0.000572 endif | |
1000 0.002401 let is_pty = get(a:000, 0, 0) | |
1000 0.002208 let npipe = get(a:000, 1, 3) | |
1000 4.006945 0.011152 return s:pgroup_open(statements, is_pty && !vimproc#util#is_windows(), npipe) | |
FUNCTION <SNR>138_read() | |
Called 9356 times | |
Total time: 1.895481 | |
Self time: 0.263146 | |
count total (s) self (s) | |
9356 0.016244 if self.__eof | |
let self.eof = 1 | |
return '' | |
endif | |
9356 0.024166 let number = get(a:000, 0, -1) | |
9356 0.026806 let timeout = get(a:000, 1, s:read_timeout) | |
9356 1.615723 0.064655 let [hd, eof] = self.f_read(number, timeout) | |
9356 0.020678 let self.eof = eof | |
9356 0.015724 let self.__eof = eof | |
9356 0.015287 if hd == '' | |
8356 0.007867 return '' | |
endif | |
" Note: if output string is too long, if_lua is too slow. | |
1000 0.099418 0.018151 return (vimproc#util#has_lua() && len(hd) < 1024) ? s:hd2str_lua([hd]) : s:hd2str([hd]) | |
" return s:hd2str([hd]) | |
FUNCTION <SNR>138_list2str() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:hd2str(s:list2hd([a:lis])) | |
FUNCTION <SNR>138_vp_get_winsize() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if self.is_pty && vimproc#util#is_windows() | |
return [winwidth(0)-5, winheight(0)] | |
endif | |
for pid in self.pid_list | |
let [width, height] = s:libcall('vp_pty_get_winsize', [pid]) | |
endfor | |
return [width, height] | |
FUNCTION <SNR>138_pgroup_open() | |
Called 1000 times | |
Total time: 3.995793 | |
Self time: 0.109928 | |
count total (s) self (s) | |
1000 0.001661 let proc = {} | |
1000 3.544760 0.015346 let proc.current_proc = vimproc#plineopen{a:npipe}(a:statements[0].statement, a:is_pty) | |
1000 0.003669 let proc.pid = proc.current_proc.pid | |
1000 0.002456 let proc.pid_list = proc.current_proc.pid_list | |
1000 0.004830 let proc.condition = a:statements[0].condition | |
1000 0.003505 let proc.statements = a:statements[1:] | |
1000 0.119247 0.007980 let proc.stdin = s:fdopen_pgroup(proc, proc.current_proc.stdin, 'vp_pgroup_close', 'read_pgroup', 'write_pgroup') | |
1000 0.115930 0.007500 let proc.stdout = s:fdopen_pgroup(proc, proc.current_proc.stdout, 'vp_pgroup_close', 'read_pgroup', 'write_pgroup') | |
1000 0.115663 0.007218 let proc.stderr = s:fdopen_pgroup(proc, proc.current_proc.stderr, 'vp_pgroup_close', 'read_pgroup', 'write_pgroup') | |
1000 0.019264 0.005066 let proc.kill = s:funcref('vp_pgroup_kill') | |
1000 0.019244 0.005133 let proc.waitpid = s:funcref('vp_pgroup_waitpid') | |
1000 0.002062 let proc.is_valid = 1 | |
1000 0.001756 let proc.is_pty = 0 | |
" echomsg expand('<sfile>') | |
" echomsg 'open:' string(map(copy(proc.current_proc.stdin.fd), 'v:val.fd')) | |
" echomsg 'open:' string(map(copy(proc.current_proc.stdout.fd), 'v:val.fd')) | |
" echomsg 'open:' string(map(copy(proc.current_proc.stderr.fd), 'v:val.fd')) | |
1000 0.004262 return proc | |
FUNCTION <SNR>138_write_pipes() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let timeout = get(a:000, 0, s:write_timeout) | |
if self.fd[0].eof | |
return 0 | |
endif | |
" Write data. | |
let nleft = self.fd[0].write(a:str, timeout) | |
let self.eof = self.fd[0].eof | |
return nleft | |
FUNCTION <SNR>138_vp_pgroup_kill() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if a:sig != 0 | |
call s:close_all(self) | |
let self.is_valid = 0 | |
endif | |
if self.pid == 0 | |
" Ignore. | |
return | |
endif | |
return self.current_proc.kill(a:sig) | |
FUNCTION <SNR>138_str2list() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return map(range(len(a:str)), 'char2nr(a:str[v:val])') | |
FUNCTION <SNR>138_list2hd() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return join(map(a:lis, 'printf("%02X", v:val)'), '') | |
FUNCTION <SNR>138_finalize() | |
Called 1 time | |
Total time: 0.000262 | |
Self time: 0.000018 | |
count total (s) self (s) | |
1 0.000040 0.000007 call s:garbage_collect(1) | |
1 0.000004 if exists('s:dll_handle') | |
1 0.000216 0.000005 call s:vp_dlclose(s:dll_handle) | |
1 0.000001 endif | |
FUNCTION <SNR>138_vp_checkpid() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
try | |
let [cond, status] = s:libcall('vp_waitpid', [self.pid]) | |
if cond !=# 'run' | |
let [self.cond, self.status] = [cond, status] | |
endif | |
catch /waitpid() error:\|vp_waitpid:/ | |
let [cond, status] = ['error', '0'] | |
endtry | |
return [cond, str2nr(status)] | |
FUNCTION <SNR>138_str2hd() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return join(map(range(len(a:str)), 'printf("%02X", char2nr(a:str[v:val]))'), '') | |
FUNCTION vimproc#delete_trash() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if !vimproc#util#is_windows() | |
call s:print_error('Not implemented in this platform.') | |
return | |
endif | |
let filename = a:filename | |
if !filewritable(filename) && !isdirectory(filename) | |
return 1 | |
endif | |
" Substitute path separator to "/". | |
let filename = substitute( fnamemodify(filename, ':p'), '/', '\\', 'g') | |
" Delete last /. | |
if filename =~ '[^:][/\\]$' | |
" Delete last /. | |
let filename = filename[: -2] | |
endif | |
" Encoding conversion. | |
let filename = vimproc#util#iconv(filename, &encoding, vimproc#util#termencoding()) | |
let [ret] = s:libcall('vp_delete_trash', [filename]) | |
return str2nr(ret) | |
FUNCTION vimproc#get_last_errmsg() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return substitute(vimproc#util#iconv(s:last_errmsg, vimproc#util#stderrencoding(), &encoding), '\n$', '', '') | |
FUNCTION <SNR>138_write_pgroup() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let timeout = get(a:000, 0, s:write_timeout) | |
let nleft = 0 | |
if !self.fd.eof | |
" Write data. | |
let nleft = self.fd.write(a:str, timeout) | |
endif | |
return nleft | |
FUNCTION vimproc#ptyopen() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let commands = type(a:commands) == type('') ? vimproc#parser#parse_pipe(a:commands) : a:commands | |
let npipe = get(a:000, 0, 3) | |
return s:plineopen(npipe, commands, !vimproc#util#is_windows()) | |
FUNCTION vimproc#system2() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if empty(a:000) | |
return '' | |
endif | |
if len(a:0) > 1 | |
let args = deepcopy(a:000) | |
let args[1] = vimproc#util#iconv( args[1], &encoding, vimproc#util#stdinencoding()) | |
else | |
let args = a:000 | |
endif | |
let output = call('vimproc#system', args) | |
" This function converts application encoding to &encoding. | |
let output = vimproc#util#iconv( output, vimproc#util#stdoutencoding(), &encoding) | |
let s:last_errmsg = vimproc#util#iconv( s:last_errmsg, vimproc#util#stderrencoding(), &encoding) | |
return output | |
FUNCTION vimproc#write() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if a:string == '' | |
return | |
endif | |
let mode = get(a:000, 0, a:filename =~ '^>' ? 'a' : 'w') | |
let filename = a:filename =~ '^>' ? a:filename[1:] : a:filename | |
if filename ==# '/dev/null' | |
" Nothing. | |
elseif filename ==# '/dev/clip' | |
" Write to clipboard. | |
if mode =~ 'a' | |
let @+ .= a:string | |
else | |
let @+ = a:string | |
endif | |
elseif filename ==# '/dev/quickfix' | |
" Write to quickfix. | |
let qflist = getqflist() | |
for str in split(a:string, '\n\|\r\n') | |
if str =~ '^.\+:.\+:.\+$' | |
let line = split(str[2:], ':') | |
let filename = str[:1] . line[0] | |
if len(line) >= 3 && line[1] =~ '^\d\+$' | |
call add(qflist, { 'filename' : filename, 'lnum' : line[1], 'text' : join(line[2:], ':'), }) | |
else | |
call add(qflist, { 'text' : str, }) | |
endif | |
endif | |
endfor | |
call setqflist(qflist) | |
else | |
" Write file. | |
let mode = 'O_WRONLY | O_CREAT' | |
if mode =~ 'a' | |
" Append mode. | |
let mode .= '| O_APPEND' | |
endif | |
let hfile = vimproc#fopen(filename, mode) | |
call hfile.write(a:string) | |
call hfile.close() | |
endif | |
FUNCTION vimproc#readdir() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let dirname = substitute(substitute( vimproc#util#expand(a:dirname), '\\', '/', 'g'), '/$', '', '') | |
if dirname == '' | |
let dirname = getcwd() | |
endif | |
if !isdirectory(dirname) | |
return [] | |
endif | |
let dirname = vimproc#util#iconv(dirname, &encoding, vimproc#util#termencoding()) | |
try | |
let files = s:libcall('vp_readdir', [dirname]) | |
catch /vp_readdir/ | |
return [] | |
endtry | |
call map(files, 'vimproc#util#iconv( v:val, vimproc#util#termencoding(), &encoding)') | |
if vimproc#util#is_windows() | |
call map(files, 'vimproc#util#substitute_path_separator(v:val)') | |
endif | |
return files | |
FUNCTION <SNR>138_garbage_collect() | |
Called 1 time | |
Total time: 0.000033 | |
Self time: 0.000033 | |
count total (s) self (s) | |
1 0.000005 for pid in values(s:bg_processes) | |
" Check processes. | |
try | |
let [cond, status] = s:libcall('vp_waitpid', [pid]) | |
" echomsg string([pid, cond, status]) | |
if cond !=# 'run' || a:is_force | |
if cond !=# 'exit' | |
" Kill process. | |
" 15 == SIGTERM | |
call vimproc#kill(pid, 15) | |
endif | |
if vimproc#util#is_windows() | |
call s:libcall('vp_close_handle', [pid]) | |
endif | |
call remove(s:bg_processes, pid) | |
endif | |
catch | |
" Ignore error. | |
endtry | |
endfor | |
FUNCTION <SNR>138_read_pipes() | |
Called 9356 times | |
Total time: 2.156500 | |
Self time: 0.261019 | |
count total (s) self (s) | |
9356 0.042171 if type(self.fd[-1]) != type({}) | |
let self.eof = 1 | |
return '' | |
endif | |
9356 0.024645 let number = get(a:000, 0, -1) | |
9356 0.027400 let timeout = get(a:000, 1, s:read_timeout) | |
9356 1.963108 0.067627 let output = self.fd[-1].read(number, timeout) | |
9356 0.031171 let self.eof = self.fd[-1].eof | |
9356 0.012067 return output | |
FUNCTION <SNR>138_split() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let [result, pos] = [[], 0] | |
while 1 | |
let tmp = stridx(a:str, a:sep, pos) | |
if tmp == -1 | |
call add(result, strpart(a:str, pos)) | |
break | |
endif | |
call add(result, strpart(a:str, pos, tmp - pos)) | |
let pos = tmp + 1 | |
endwhile | |
return result | |
FUNCTION <SNR>138_vp_file_open() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let [fd] = s:libcall('vp_file_open', [a:path, a:flags, a:mode]) | |
return fd | |
FUNCTION <SNR>138_is_pseudo_device() | |
Called 2000 times | |
Total time: 0.022227 | |
Self time: 0.019010 | |
count total (s) self (s) | |
2000 0.012032 0.008815 if vimproc#util#is_windows() && ( a:filename ==# '/dev/stdin' || a:filename ==# '/dev/stdout' || a:filename ==# '/dev/stderr') | |
return 1 | |
endif | |
2000 0.004755 return a:filename == '' || a:filename ==# '/dev/null' || a:filename ==# '/dev/clip' || a:filename ==# '/dev/quickfix' | |
FUNCTION vimproc#shellescape() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return string(a:string) | |
FUNCTION vimproc#version() | |
Called 2 times | |
Total time: 0.000012 | |
Self time: 0.000012 | |
count total (s) self (s) | |
2 0.000012 return str2nr(printf('%2d%02d', 7, 1)) | |
FUNCTION <SNR>138_vp_pgroup_waitpid() | |
Called 1000 times | |
Total time: 0.085478 | |
Self time: 0.016345 | |
count total (s) self (s) | |
1000 0.073563 0.004430 call s:close_all(self) | |
1000 0.001291 let self.is_valid = 0 | |
1000 0.003289 if !has_key(self, 'cond') || !has_key(self, 'status') | |
return s:waitpid(self.pid) | |
endif | |
1000 0.002002 return [self.cond, self.status] | |
FUNCTION <SNR>138_vp_file_write() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let [nleft] = s:libcall('vp_file_write', [self.fd, a:hd, a:timeout]) | |
return nleft | |
FUNCTION <SNR>138_read_pgroup() | |
Called 9356 times | |
Total time: 3.426001 | |
Self time: 0.683132 | |
count total (s) self (s) | |
9356 0.034184 let number = get(a:000, 0, -1) | |
9356 0.030908 let timeout = get(a:000, 1, s:read_timeout) | |
9356 0.014696 let output = '' | |
9356 0.014984 if !self.fd.eof | |
9356 2.216692 0.060192 let output = self.fd.read(number, timeout) | |
9356 0.007769 endif | |
9356 0.024740 if self.proc.current_proc.stdout.eof && self.proc.current_proc.stderr.eof | |
" Get status. | |
1000 0.596819 0.010450 let [cond, status] = self.proc.current_proc.waitpid() | |
1000 0.003936 if empty(self.proc.statements) || (self.proc.condition ==# 'true' && status) || (self.proc.condition ==# 'false' && !status) | |
1000 0.002061 let self.proc.statements = [] | |
" Caching status. | |
1000 0.002150 let self.proc.cond = cond | |
1000 0.001958 let self.proc.status = status | |
1000 0.000712 else | |
" Initialize next statement. | |
let proc = vimproc#plineopen3(self.proc.statements[0].statement) | |
let self.proc.current_proc = proc | |
let self.pid = proc.pid | |
let self.pid_list = proc.pid_list | |
let self.proc.condition = self.proc.statements[0].condition | |
let self.proc.statements = self.proc.statements[1:] | |
let self.proc.stdin = s:fdopen_pgroup(self.proc, proc.stdin, 'vp_pgroup_close', 'read_pgroup', 'write_pgroup') | |
let self.proc.stdout = s:fdopen_pgroup(self.proc, proc.stdout, 'vp_pgroup_close', 'read_pgroup', 'write_pgroup') | |
let self.proc.stderr = s:fdopen_pgroup(self.proc, proc.stderr, 'vp_pgroup_close', 'read_pgroup', 'write_pgroup') | |
endif | |
1000 0.000483 endif | |
9356 0.014687 if self.proc.current_proc.stdout.eof | |
1360 0.002291 let self.proc.stdout.eof = 1 | |
1360 0.002054 let self.proc.stdout.__eof = 1 | |
1360 0.000849 endif | |
9356 0.013000 if self.proc.current_proc.stderr.eof | |
1640 0.002700 let self.proc.stderr.eof = 1 | |
1640 0.002402 let self.proc.stderr.__eof = 1 | |
1640 0.001012 endif | |
9356 0.009712 return output | |
FUNCTION <SNR>138_hd2list() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return map(split(a:hd, '..\zs'), 'str2nr(v:val, 16)') | |
FUNCTION vimproc#open() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let filename = vimproc#util#iconv(fnamemodify(a:filename, ':p'), &encoding, vimproc#util#termencoding()) | |
if filename =~ '^\%(https\?\|ftp\)://' && !vimproc#host_exists(filename) | |
" URI is invalid. | |
call s:print_error('vimproc#open: URI "' . filename . '" is invalid.') | |
return | |
endif | |
" Detect desktop environment. | |
if vimproc#util#is_windows() | |
" For URI only. | |
"execute '!start rundll32 url.dll,FileProtocolHandler' filename | |
call s:libcall('vp_open', [filename]) | |
elseif has('win32unix') | |
" Cygwin. | |
call vimproc#system(['cygstart', filename]) | |
elseif executable('xdg-open') | |
" Linux. | |
call vimproc#system_bg(['xdg-open', filename]) | |
elseif exists('$KDE_FULL_SESSION') && $KDE_FULL_SESSION ==# 'true' | |
" KDE. | |
call vimproc#system_bg(['kioclient', 'exec', filename]) | |
elseif exists('$GNOME_DESKTOP_SESSION_ID') | |
" GNOME. | |
call vimproc#system_bg(['gnome-open', filename]) | |
elseif executable('exo-open') | |
" Xfce. | |
call vimproc#system_bg(['exo-open', filename]) | |
elseif vimproc#util#is_mac() && executable('open') | |
" Mac OS. | |
call vimproc#system_bg(['open', filename]) | |
else | |
" Give up. | |
call s:print_error('vimproc#open: Not supported.') | |
endif | |
FUNCTION <SNR>138_vp_set_winsize() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if vimproc#util#is_windows() || !self.is_valid | |
" Not implemented. | |
return | |
endif | |
if self.is_pty | |
if self.stdin.eof == 0 && self.stdin.fd[-1].is_pty | |
call s:libcall('vp_pty_set_winsize', [self.stdin.fd[-1].fd, a:width-5, a:height]) | |
endif | |
if self.stdout.eof == 0 && self.stdout.fd[0].is_pty | |
call s:libcall('vp_pty_set_winsize', [self.stdout.fd[0].fd, a:width-5, a:height]) | |
endif | |
if self.stderr.eof == 0 && self.stderr.fd[0].is_pty | |
call s:libcall('vp_pty_set_winsize', [self.stderr.fd[0].fd, a:width-5, a:height]) | |
endif | |
endif | |
" Send SIGWINCH = 28 signal. | |
for pid in self.pid_list | |
call vimproc#kill(pid, 28) | |
endfor | |
FUNCTION <SNR>138_vp_socket_write() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let [nleft] = s:libcall('vp_socket_write', [self.fd, a:hd, a:timeout]) | |
return nleft | |
FUNCTION vimproc#plineopen2() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let commands = type(a:commands) == type('') ? vimproc#parser#parse_pipe(a:commands) : a:commands | |
let is_pty = get(a:000, 0, 0) | |
return s:plineopen(2, commands, is_pty) | |
FUNCTION vimproc#fopen() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let mode = get(a:000, 0, 0644) | |
let fd = s:vp_file_open(a:path, a:flags, mode) | |
let proc = s:fdopen(fd, 'vp_file_close', 'vp_file_read', 'vp_file_write') | |
return proc | |
FUNCTION vimproc#get_last_status() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:last_status | |
FUNCTION <SNR>138_funcref() | |
Called 67000 times | |
Total time: 0.895698 | |
Self time: 0.403795 | |
count total (s) self (s) | |
67000 0.867196 0.375293 return function(s:SID_PREFIX().a:funcname) | |
FUNCTION <SNR>138_vp_pipe_open() | |
Called 1000 times | |
Total time: 0.757655 | |
Self time: 0.077015 | |
count total (s) self (s) | |
1000 0.005128 0.003435 if vimproc#util#is_windows() | |
let cmdline = s:quote_arg(substitute(a:argv[0], '/', '\', 'g')) | |
for arg in a:argv[1:] | |
let cmdline .= ' ' . s:quote_arg(arg) | |
endfor | |
let [pid; fdlist] = s:libcall('vp_pipe_open', [a:npipe, a:hstdin, a:hstdout, a:hstderr, cmdline]) | |
else | |
1000 0.714209 0.035262 let [pid; fdlist] = s:libcall('vp_pipe_open', [a:npipe, a:hstdin, a:hstdout, a:hstderr, len(a:argv)] + a:argv) | |
1000 0.001351 endif | |
1000 0.002933 if a:npipe != len(fdlist) | |
call s:print_error(printf('a:npipe = %d, a:argv = %s', a:npipe, string(a:argv))) | |
call s:print_error(printf('fdlist = %s', string(fdlist))) | |
echoerr 'Bug behavior is detected!: ' . pid | |
endif | |
1000 0.007427 return [pid] + fdlist | |
FUNCTION <SNR>138_fdopen() | |
Called 3000 times | |
Total time: 0.495004 | |
Self time: 0.177015 | |
count total (s) self (s) | |
3000 0.475370 0.157381 return { 'fd' : a:fd, 'eof' : 0, '__eof' : 0, 'is_valid' : 1, 'buffer' : '', 'f_close' : s:funcref(a:f_close), 'f_read' : s:funcref(a:f_read), 'f_write' : s:funcref(a:f_write), 'close' : s:funcref('close'), 'read' : s:funcref('read'), 'write' : s:funcref('write'), 'read_line' : s:funcref('read_line'), 'read_lines' : s:funcref('read_lines'),} | |
FUNCTION <SNR>138_vp_dlopen() | |
Called 1 time | |
Total time: 0.000498 | |
Self time: 0.000014 | |
count total (s) self (s) | |
1 0.000493 0.000009 let [handle] = s:libcall('vp_dlopen', [a:path]) | |
1 0.000001 return handle | |
FUNCTION vimproc#system_passwd() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if type(a:cmdline) == type('') | |
let args = vimproc#parser#parse_pipe(a:cmdline) | |
else | |
let args = [{ 'fd' : { 'stdin' : '', 'stdout' : '', 'stderr' : '' }, 'args' : a:cmdline }] | |
endif | |
let timeout = a:0 >= 2 ? a:2 : 0 | |
let input = a:0 >= 1 ? a:1 : '' | |
let lang_save = $LANG | |
try | |
let $LANG = 'C' | |
return s:system(args, 1, input, timeout, 1) | |
finally | |
let $LANG = lang_save | |
endtry | |
FUNCTION <SNR>138_hd2str() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
" a:hd is a list because to avoid copying the value. | |
return get(s:libcall('vp_decode', [a:hd[0]]), 0, '') | |
FUNCTION vimproc#dll_version() | |
Called 1 time | |
Total time: 0.000125 | |
Self time: 0.000011 | |
count total (s) self (s) | |
1 0.000121 0.000007 let [dll_version] = s:libcall('vp_dlversion', []) | |
1 0.000002 return str2nr(dll_version) | |
FUNCTION <SNR>138_vp_pipe_close() | |
Called 3000 times | |
Total time: 0.527363 | |
Self time: 0.039491 | |
count total (s) self (s) | |
" echomsg 'close:'.self.fd | |
3000 0.005174 if self.fd != 0 | |
3000 0.509330 0.021458 call s:libcall('vp_pipe_close', [self.fd]) | |
3000 0.005997 let self.fd = 0 | |
3000 0.002069 endif | |
FUNCTION vimproc#test_readdir() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let start = reltime() | |
call split(glob(a:dirname.'/*'), '\n') | |
echomsg reltimestr(reltime(start)) | |
let start = reltime() | |
call vimproc#readdir(a:dirname) | |
echomsg reltimestr(reltime(start)) | |
FUNCTION <SNR>138_vp_pty_open() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let [pid; fdlist] = s:libcall('vp_pty_open', [a:npipe, a:width, a:height, a:hstdin, a:hstdout, a:hstderr, len(a:argv)] + a:argv) | |
return [pid] + fdlist | |
FUNCTION <SNR>138_vp_waitpid() | |
Called 1000 times | |
Total time: 0.586369 | |
Self time: 0.046502 | |
count total (s) self (s) | |
1000 0.390073 0.006374 call s:close_all(self) | |
1000 0.001996 let self.is_valid = 0 | |
1000 0.003172 if has_key(self, 'cond') && has_key(self, 'status') | |
" Use cache. | |
let [cond, status] = [self.cond, self.status] | |
else | |
1000 0.163222 0.007054 let [cond, status] = s:waitpid(self.pid) | |
1000 0.000711 endif | |
1000 0.001435 if cond ==# 'exit' | |
1000 0.001497 let self.pid = 0 | |
1000 0.000594 endif | |
1000 0.002170 if has_key(self, 'pid_list') | |
1000 0.003039 for pid in self.pid_list[: -2] | |
call s:waitpid(pid) | |
endfor | |
1000 0.000539 endif | |
1000 0.002730 return [cond, str2nr(status)] | |
FUNCTION <SNR>138_vp_pty_close() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
call s:libcall('vp_pty_close', [self.fd]) | |
FUNCTION <SNR>138_vp_pipe_write() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if self.fd == 0 | |
return 0 | |
endif | |
let [nleft] = s:libcall('vp_pipe_write', [self.fd, a:hd, a:timeout]) | |
return nleft | |
FUNCTION <SNR>138_quote_arg() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return a:arg =~ '[ "]' ? '"' . substitute(a:arg, '"', '\\"', 'g') . '"' : a:arg | |
FUNCTION <SNR>138_vp_pipe_read() | |
Called 9356 times | |
Total time: 1.551068 | |
Self time: 0.164498 | |
count total (s) self (s) | |
9356 0.017650 if self.fd == 0 | |
return ['', 1] | |
endif | |
9356 1.480660 0.094090 let [hd, eof] = s:libcall('vp_pipe_read', [self.fd, a:number, a:timeout]) | |
9356 0.021298 return [hd, eof] | |
FUNCTION <SNR>138_hd2str_lua() | |
Called 1000 times | |
Total time: 0.071949 | |
Self time: 0.071949 | |
count total (s) self (s) | |
1000 0.002795 let ret = [] | |
1000 0.001052 lua << EOF | |
do | |
local ret = vim.eval('ret') | |
local hd = vim.eval('a:hd') | |
if hd[0] == nil then | |
hd[0] = '' | |
end | |
local len = string.len(hd[0]) | |
local s = '' | |
for i = 1, len, 2 do | |
s = s .. string.char(tonumber(string.sub(hd[0], i, i+1), 16)) | |
end | |
ret:add(s) | |
end | |
EOF | |
1000 0.003952 return ret[0] | |
FUNCTION <SNR>138_split_lua() | |
Called 14359 times | |
Total time: 0.659017 | |
Self time: 0.659017 | |
count total (s) self (s) | |
14359 0.030242 let result = [] | |
14359 0.014658 lua << EOF | |
do | |
local pos = 1 | |
local result = vim.eval('result') | |
local str = vim.eval('a:str') | |
local sep = vim.eval('a:sep') | |
local tmp = string.find(str, sep, pos, true) | |
while tmp ~= nil do | |
result:add(string.sub(str, pos, tmp-1)) | |
pos = tmp + 1 | |
tmp = string.find(str, sep, pos, true) | |
end | |
result:add(string.sub(str, pos)) | |
end | |
EOF | |
14359 0.022489 return result | |
FUNCTION vimproc#socket_open() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let fd = s:vp_socket_open(a:host, a:port) | |
return s:fdopen(fd, 'vp_socket_close', 'vp_socket_read', 'vp_socket_write') | |
FUNCTION <SNR>138_vp_pty_write() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let [nleft] = s:libcall('vp_pty_write', [self.fd, a:hd, a:timeout]) | |
return nleft | |
FUNCTION <SNR>138_vp_pgroup_close() | |
Called 3000 times | |
Total time: 0.338121 | |
Self time: 0.010626 | |
count total (s) self (s) | |
3000 0.336943 0.009448 call self.fd.close() | |
FUNCTION <SNR>138_fdopen_pty() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return { 'eof' : 0, '__eof' : 0, 'is_valid' : 1, 'buffer' : '', 'fd_stdin' : a:fd_stdin, 'fd_stdout' : a:fd_stdout, 'f_close' : s:funcref(a:f_close), 'f_read' : s:funcref(a:f_read), 'f_write' : s:funcref(a:f_write), 'close' : s:funcref('close'), 'read' : s:funcref('read'), 'write' : s:funcref('write'), 'read_line' : s:funcref('read_line'), 'read_lines' : s:funcref('read_lines'),} | |
FUNCTION <SNR>138_vp_file_close() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if self.fd != 0 | |
call s:libcall('vp_file_close', [self.fd]) | |
let self.fd = 0 | |
endif | |
FUNCTION <SNR>138_vp_pty_read() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let [hd, eof] = s:libcall('vp_pty_read', [self.fd, a:number, a:timeout]) | |
return [hd, eof] | |
FUNCTION <SNR>138_fdopen_pgroup() | |
Called 3000 times | |
Total time: 0.328142 | |
Self time: 0.081421 | |
count total (s) self (s) | |
3000 0.326412 0.079691 return { 'eof' : 0, '__eof' : 0, 'is_valid' : 1, 'buffer' : '', 'proc' : a:proc, 'fd' : a:fd, 'f_close' : s:funcref(a:f_close), 'close' : s:funcref('close'), 'read' : s:funcref(a:f_read), 'write' : s:funcref(a:f_write), 'read_line' : s:funcref('read_line'), 'read_lines' : s:funcref('read_lines'),} | |
FUNCTION <SNR>138_vp_pipes_close() | |
Called 3000 times | |
Total time: 0.628151 | |
Self time: 0.067420 | |
count total (s) self (s) | |
6000 0.010642 for fd in self.fd | |
3000 0.003278 try | |
3000 0.571342 0.010611 call fd.close() | |
3000 0.013388 catch /vimproc: vp_pipe_close: / | |
" Ignore error. | |
endtry | |
3000 0.002753 endfor | |
FUNCTION <SNR>138_write() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let timeout = get(a:000, 0, s:write_timeout) | |
let hd = s:str2hd(a:str) | |
return self.f_write(hd, timeout) | |
FUNCTION <SNR>138_vp_socket_close() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
call s:libcall('vp_socket_close', [self.fd]) | |
let self.is_valid = 0 | |
FUNCTION vimproc#host_exists() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let rval = s:vp_host_exists( substitute(substitute(a:host, '^\a\+://', '', ''), '/.*$', '', '')) | |
return 0 + rval | |
FUNCTION vimproc#system_gui() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if vimproc#util#is_windows() | |
silent execute ':!start ' . join(map(vimproc#parser#split_args(a:cmdline), '"\"".v:val."\""')) | |
return '' | |
else | |
return vimproc#system_bg(a:cmdline) | |
endif | |
FUNCTION <SNR>138_vp_socket_open() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let [socket] = s:libcall('vp_socket_open', [a:host, a:port]) | |
return socket | |
FUNCTION vimproc#analyze_shebang() | |
Called 1000 times | |
Total time: 0.184995 | |
Self time: 0.181418 | |
count total (s) self (s) | |
1000 0.085193 0.081616 if !filereadable(a:filename) || getfsize(a:filename) > 100000 || (vimproc#util#is_windows() && '.'.fnamemodify(a:filename, ':e') !~? '^'.substitute($PATHEXT, ';', '$\\|^', 'g').'$') | |
" Maybe a binary file. | |
return [a:filename] | |
endif | |
1000 0.073071 let lines = readfile(a:filename, '', 1) | |
1000 0.018936 if empty(lines) || lines[0] !~ '^#!.\+' | |
" Shebang not found. | |
1000 0.002198 return [a:filename] | |
endif | |
" Get shebang line. | |
let shebang = split(matchstr(lines[0], '^#!\zs.\+')) | |
" Convert command name. | |
if vimproc#util#is_windows() && shebang[0] =~ '^/' | |
let shebang[0] = vimproc#get_command_name( fnamemodify(shebang[0], ':t')) | |
endif | |
return shebang + [a:filename] | |
FUNCTION <SNR>138_vp_kill() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if a:sig != 0 | |
call s:close_all(self) | |
let self.is_valid = 0 | |
endif | |
let ret = 0 | |
for pid in get(self, 'pid_list', [self.pid]) | |
let ret = vimproc#kill(pid, a:sig) | |
endfor | |
return ret | |
FUNCTION <SNR>138_vp_file_read() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let [hd, eof] = s:libcall('vp_file_read', [self.fd, a:number, a:timeout]) | |
return [hd, eof] | |
FUNCTION <SNR>138_fdopen_pipes() | |
Called 3000 times | |
Total time: 0.312033 | |
Self time: 0.075936 | |
count total (s) self (s) | |
3000 0.310386 0.074289 return { 'eof' : 0, '__eof' : 0, 'is_valid' : 1, 'buffer' : '', 'fd' : a:fd, 'f_close' : s:funcref(a:f_close), 'close' : s:funcref('close'), 'read' : s:funcref(a:f_read), 'write' : s:funcref(a:f_write), 'read_line' : s:funcref('read_line'), 'read_lines' : s:funcref('read_lines'),} | |
FUNCTION vimproc#get_command_name() | |
Called 1000 times | |
Total time: 1.127238 | |
Self time: 0.043689 | |
count total (s) self (s) | |
1000 0.003952 let path = get(a:000, 0, $PATH) | |
1000 0.002176 let cnt = a:0 < 2 ? 1 : a:2 | |
1000 1.105071 0.021522 let files = split(substitute(vimproc#util#substitute_path_separator( vimproc#filepath#which(a:command, path)), '//', '/', 'g'), '\n') | |
1000 0.001479 if cnt < 0 | |
return files | |
endif | |
1000 0.003021 let file = get(files, 0, '') | |
1000 0.001506 if file == '' | |
throw printf( 'vimproc#get_command_name: File "%s" is not found.', a:command) | |
endif | |
1000 0.000903 return file | |
FUNCTION <SNR>138_read_line() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let lines = call(self.read_lines, a:000, self) | |
let self.buffer = join(lines[1:], "\n") . self.buffer | |
let self.eof = (self.buffer != '') ? 0 : self.__eof | |
return get(lines, 0, '') | |
FUNCTION <SNR>138_print_error() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
echohl Error | echomsg a:string | echohl None | |
FUNCTION <SNR>138_read_lines() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let res = self.buffer | |
while !self.eof && stridx(res, "\n") < 0 | |
let out = call(self.read, a:000, self) | |
if out == '' | |
break | |
endif | |
let res .= out | |
endwhile | |
let lines = split(res, '\r\?\n', 1) | |
if self.eof | |
let self.buffer = '' | |
return lines | |
else | |
let self.buffer = empty(lines)? '' : lines[-1] | |
let lines = lines[ : -2] | |
endif | |
let self.eof = (self.buffer != '') ? 0 : self.__eof | |
return lines | |
FUNCTION <SNR>138_vp_host_exists() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let [rval] = s:libcall('vp_host_exists', [a:host]) | |
return rval | |
FUNCTION <SNR>138_SID_PREFIX() | |
Called 67000 times | |
Total time: 0.491903 | |
Self time: 0.491903 | |
count total (s) self (s) | |
67000 0.172476 if !exists('s:sid_prefix') | |
1 0.000139 let s:sid_prefix = matchstr(expand('<sfile>'), '<SNR>\d\+_\zeSID_PREFIX$') | |
1 0.000002 endif | |
67000 0.076028 return s:sid_prefix | |
FUNCTION <SNR>138_vp_socket_read() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let [hd, eof] = s:libcall('vp_socket_read', [self.fd, a:number, a:timeout]) | |
return [hd, eof] | |
FUNCTION <SNR>138_libcall() | |
Called 14359 times | |
Total time: 2.675720 | |
Self time: 1.859090 | |
count total (s) self (s) | |
" End Of Value | |
14359 0.029978 let EOV = "\xFF" | |
14359 0.176311 let args = empty(a:args) ? '' : (join(reverse(copy(a:args)), EOV) . EOV) | |
14359 1.072814 let stack_buf = libcall(g:vimproc#dll_path, a:func, args) | |
14359 1.058982 0.242352 let result = vimproc#util#has_lua() ? s:split_lua(stack_buf, EOV) : s:split(stack_buf, EOV) | |
14359 0.062180 if !empty(result) && result[-1] != '' | |
if stack_buf[len(stack_buf) - 1] ==# EOV | |
" Note: If &encoding equals "cp932" and output ends multibyte first byte, | |
" will fail split. | |
return result | |
endif | |
let s:lasterr = result | |
let msg = vimproc#util#iconv(string(result), vimproc#util#termencoding(), &encoding) | |
throw printf('vimproc: %s: %s', a:func, msg) | |
endif | |
14359 0.039096 return result[:-2] | |
FUNCTION <SNR>138_close_all() | |
Called 2000 times | |
Total time: 0.452832 | |
Self time: 0.043938 | |
count total (s) self (s) | |
2000 0.005865 if has_key(a:self, 'stdin') | |
2000 0.026296 0.008252 call a:self.stdin.close() | |
2000 0.001306 endif | |
2000 0.004268 if has_key(a:self, 'stdout') | |
2000 0.210704 0.006763 call a:self.stdout.close() | |
2000 0.001290 endif | |
2000 0.004273 if has_key(a:self, 'stderr') | |
2000 0.194011 0.007102 call a:self.stderr.close() | |
2000 0.001222 endif | |
FUNCTIONS SORTED ON TOTAL TIME | |
count total (s) self (s) function | |
1000 19.942873 0.076270 vimproc#system() | |
1000 8.385927 0.517855 <SNR>138_system() | |
1000 4.026835 0.031042 vimproc#pgroup_open() | |
1000 3.995793 0.109928 <SNR>138_pgroup_open() | |
1000 3.529414 0.026729 vimproc#plineopen3() | |
1000 3.502685 0.496405 <SNR>138_plineopen() | |
9356 3.426001 0.683132 <SNR>138_read_pgroup() | |
14359 2.675720 1.859090 <SNR>138_libcall() | |
9356 2.156500 0.261019 <SNR>138_read_pipes() | |
9356 1.895481 0.263146 <SNR>138_read() | |
13000 1.625115 0.085664 <SNR>138_close() | |
9356 1.551068 0.164498 <SNR>138_vp_pipe_read() | |
1000 1.350861 0.036948 <SNR>138_convert_args() | |
1000 1.127238 0.043689 vimproc#get_command_name() | |
67000 0.895698 0.403795 <SNR>138_funcref() | |
1000 0.757655 0.077015 <SNR>138_vp_pipe_open() | |
14359 0.659017 <SNR>138_split_lua() | |
3000 0.628151 0.067420 <SNR>138_vp_pipes_close() | |
1000 0.586369 0.046502 <SNR>138_vp_waitpid() | |
3000 0.527363 0.039491 <SNR>138_vp_pipe_close() | |
FUNCTIONS SORTED ON SELF TIME | |
count total (s) self (s) function | |
14359 2.675720 1.859090 <SNR>138_libcall() | |
9356 3.426001 0.683132 <SNR>138_read_pgroup() | |
14359 0.659017 <SNR>138_split_lua() | |
1000 8.385927 0.517855 <SNR>138_system() | |
1000 3.502685 0.496405 <SNR>138_plineopen() | |
67000 0.491903 <SNR>138_SID_PREFIX() | |
67000 0.895698 0.403795 <SNR>138_funcref() | |
9356 1.895481 0.263146 <SNR>138_read() | |
9356 2.156500 0.261019 <SNR>138_read_pipes() | |
1000 0.184995 0.181418 vimproc#analyze_shebang() | |
3000 0.495004 0.177015 <SNR>138_fdopen() | |
9356 1.551068 0.164498 <SNR>138_vp_pipe_read() | |
1000 3.995793 0.109928 <SNR>138_pgroup_open() | |
13000 1.625115 0.085664 <SNR>138_close() | |
3000 0.328142 0.081421 <SNR>138_fdopen_pgroup() | |
1000 0.757655 0.077015 <SNR>138_vp_pipe_open() | |
1000 19.942873 0.076270 vimproc#system() | |
3000 0.312033 0.075936 <SNR>138_fdopen_pipes() | |
1000 0.071949 <SNR>138_hd2str_lua() | |
3000 0.628151 0.067420 <SNR>138_vp_pipes_close() | |
------------------------------------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment