mirror of
https://github.com/neovim/neovim.git
synced 2025-12-19 21:05:37 +00:00
docs(powershell): use tee.exe instead of Tee-Object
Problem: Tee-Object does not create a file if it does not receive input for example when :grep does not find matches. and so nvim tries to open a nonexistent errorfile causing an error. Solution: use tee.exe instead of Tee-Object
This commit is contained in:
@@ -5225,9 +5225,9 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
*shell-powershell*
|
*shell-powershell*
|
||||||
To use PowerShell: >
|
To use PowerShell: >
|
||||||
let &shell = executable('pwsh') ? 'pwsh' : 'powershell'
|
let &shell = executable('pwsh') ? 'pwsh' : 'powershell'
|
||||||
let &shellcmdflag = '-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';'
|
let &shellcmdflag = '-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';Remove-Alias -Force -ErrorAction SilentlyContinue tee;'
|
||||||
let &shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode'
|
let &shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode'
|
||||||
let &shellpipe = '2>&1 | %%{ "$_" } | Tee-Object %s; exit $LastExitCode'
|
let &shellpipe = '2>&1 | %%{ "$_" } | tee %s; exit $LastExitCode'
|
||||||
set shellquote= shellxquote=
|
set shellquote= shellxquote=
|
||||||
|
|
||||||
< This option cannot be set from a |modeline| or in the |sandbox|, for
|
< This option cannot be set from a |modeline| or in the |sandbox|, for
|
||||||
|
|||||||
@@ -24,10 +24,8 @@ describe(':make', function()
|
|||||||
it('captures stderr & non zero exit code #14349', function ()
|
it('captures stderr & non zero exit code #14349', function ()
|
||||||
nvim('set_option', 'makeprg', testprg('shell-test')..' foo')
|
nvim('set_option', 'makeprg', testprg('shell-test')..' foo')
|
||||||
local out = eval('execute("make")')
|
local out = eval('execute("make")')
|
||||||
-- Make program exit code correctly captured
|
|
||||||
matches('\nshell returned 3', out)
|
|
||||||
-- Error message is captured in the file and printed in the footer
|
-- Error message is captured in the file and printed in the footer
|
||||||
matches('\n.*%: Unknown first argument%: foo', out)
|
matches('[\r\n]+.*[\r\n]+Unknown first argument%: foo[\r\n]+%(1 of 1%)%: Unknown first argument%: foo', out)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('captures stderr & zero exit code #14349', function ()
|
it('captures stderr & zero exit code #14349', function ()
|
||||||
|
|||||||
@@ -552,7 +552,7 @@ function module.set_shell_powershell(fake)
|
|||||||
end
|
end
|
||||||
local shell = found and (is_os('win') and 'powershell' or 'pwsh') or module.testprg('pwsh-test')
|
local shell = found and (is_os('win') and 'powershell' or 'pwsh') or module.testprg('pwsh-test')
|
||||||
local cmd = 'Remove-Item -Force '..table.concat(is_os('win')
|
local cmd = 'Remove-Item -Force '..table.concat(is_os('win')
|
||||||
and {'alias:cat', 'alias:echo', 'alias:sleep', 'alias:sort'}
|
and {'alias:cat', 'alias:echo', 'alias:sleep', 'alias:sort', 'alias:tee'}
|
||||||
or {'alias:echo'}, ',')..';'
|
or {'alias:echo'}, ',')..';'
|
||||||
module.exec([[
|
module.exec([[
|
||||||
let &shell = ']]..shell..[['
|
let &shell = ']]..shell..[['
|
||||||
@@ -562,7 +562,7 @@ function module.set_shell_powershell(fake)
|
|||||||
let &shellcmdflag .= '$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';'
|
let &shellcmdflag .= '$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';'
|
||||||
let &shellcmdflag .= ']]..cmd..[['
|
let &shellcmdflag .= ']]..cmd..[['
|
||||||
let &shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode'
|
let &shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode'
|
||||||
let &shellpipe = '2>&1 | %%{ "$_" } | Tee-Object %s; exit $LastExitCode'
|
let &shellpipe = '2>&1 | %%{ "$_" } | tee %s; exit $LastExitCode'
|
||||||
]])
|
]])
|
||||||
return found
|
return found
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user