mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
system(): handle profiling and 'verbose' #8730
closes #8362 Vim's code calls `call_shell` directly from `get_system_output_as_rettv` whereas in Nvim this function has been rewritten to not call `call_shell` but to call `os_system` via `do_os_system`, losing the support for profiling and verbose. Changing the code to call `call_shell` from `get_system_output_as_rettv` seems to be too complicated to be worth it on the current version of the code. So this commit duplicates the relevant code.
This commit is contained in:
committed by
Justin M. Keyes
parent
befc7de26f
commit
a2253744c9
@@ -203,6 +203,48 @@ describe('system()', function()
|
||||
]])
|
||||
end)
|
||||
|
||||
it('prints verbose information', function()
|
||||
feed(':4verbose echo system("echo hi")<cr>')
|
||||
screen:expect([[
|
||||
|
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
|
|
||||
Calling shell to execute: "echo hi" |
|
||||
|
|
||||
hi |
|
||||
|
|
||||
Press ENTER or type command to continue^ |
|
||||
]])
|
||||
feed('<cr>')
|
||||
end)
|
||||
|
||||
it('self and total time recorded separately', function()
|
||||
local tempfile = helpers.tmpname()
|
||||
|
||||
feed(':function! AlmostNoSelfTime()<cr>')
|
||||
feed('echo system("echo hi")<cr>')
|
||||
feed('endfunction<cr>')
|
||||
|
||||
feed(':profile start ' .. tempfile .. '<cr>')
|
||||
feed(':profile func AlmostNoSelfTime<cr>')
|
||||
feed(':call AlmostNoSelfTime()<cr>')
|
||||
feed(':profile dump<cr>')
|
||||
|
||||
feed(':edit ' .. tempfile .. '<cr>')
|
||||
|
||||
local command_total_time = tonumber(helpers.funcs.split(helpers.funcs.getline(7))[2])
|
||||
local command_self_time = tonumber(helpers.funcs.split(helpers.funcs.getline(7))[3])
|
||||
|
||||
helpers.neq(nil, command_total_time)
|
||||
helpers.neq(nil, command_self_time)
|
||||
end)
|
||||
|
||||
it('`yes` interrupted with CTRL-C', function()
|
||||
feed(':call system("' .. (iswin()
|
||||
and 'for /L %I in (1,0,2) do @echo y'
|
||||
|
||||
Reference in New Issue
Block a user