From ecc4d0e435d618828b938d78fbded7fbe1314760 Mon Sep 17 00:00:00 2001 From: Enan Ajmain <3nan.ajmain@gmail.com> Date: Mon, 20 Mar 2023 03:25:12 +0600 Subject: fix(shell): on Windows :make does not echo #22728 Problem: On Windows, :make does not display the output of the program it runs. The cause is the default 'shellpipe'. On Linux, nvim uses `tee` to redirect the output to both stdout and the error file. In Windows, for both cmd.exe and powershell, the output is only redirected to the error file. Solution: - On Windows, change the 'shellpipe' default to "2>&1| tee". - Nvim includes `tee` in its Windows package. - Document recommended defaults for powershell. Fixes #12910 --- test/functional/vimscript/system_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/functional/vimscript/system_spec.lua') diff --git a/test/functional/vimscript/system_spec.lua b/test/functional/vimscript/system_spec.lua index 7ada1c4bea..158dfe86d7 100644 --- a/test/functional/vimscript/system_spec.lua +++ b/test/functional/vimscript/system_spec.lua @@ -644,12 +644,12 @@ describe('shell :!', function() if is_os('win') then feed(':4verbose %!sort /R') screen:expect{ - any=[[Executing command: .?& { Get%-Content .* | & sort /R } 2>&1 | Out%-File %-Encoding UTF8 .*; exit $LastExitCode"]] + any=[[Executing command: .?& { Get%-Content .* | & sort /R } 2>&1 | %%{ "$_" } | Out%-File .*; exit $LastExitCode"]] } else feed(':4verbose %!sort -r') screen:expect{ - any=[[Executing command: .?& { Get%-Content .* | & sort %-r } 2>&1 | Out%-File %-Encoding UTF8 .*; exit $LastExitCode"]] + any=[[Executing command: .?& { Get%-Content .* | & sort %-r } 2>&1 | %%{ "$_" } | Out%-File .*; exit $LastExitCode"]] } end feed('') -- cgit From aab95ec67e4d80e63cc5c5acc42f3832e76e0781 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Tue, 11 Apr 2023 11:18:54 +0200 Subject: test: avoid name collisions with Xtest directory (#23019) --- test/functional/vimscript/system_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/functional/vimscript/system_spec.lua') diff --git a/test/functional/vimscript/system_spec.lua b/test/functional/vimscript/system_spec.lua index 158dfe86d7..130d5d81fa 100644 --- a/test/functional/vimscript/system_spec.lua +++ b/test/functional/vimscript/system_spec.lua @@ -393,7 +393,7 @@ describe('system()', function() end) describe('with output containing NULs', function() - local fname = 'Xtest' + local fname = 'Xtest_functional_vimscript_system_nuls' before_each(create_file_with_nuls(fname)) after_each(delete_file(fname)) @@ -549,7 +549,7 @@ describe('systemlist()', function() end) describe('with output containing NULs', function() - local fname = 'Xtest' + local fname = 'Xtest_functional_vimscript_systemlist_nuls' before_each(function() command('set ff=unix') -- cgit From 1fe1bb084d0099fc4f9bfdc11189485d0f74b75a Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Mon, 19 Dec 2022 16:37:45 +0000 Subject: refactor(options): deprecate nvim[_buf|_win]_[gs]et_option Co-authored-by: zeertzjq Co-authored-by: famiu --- test/functional/vimscript/system_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/functional/vimscript/system_spec.lua') diff --git a/test/functional/vimscript/system_spec.lua b/test/functional/vimscript/system_spec.lua index 130d5d81fa..762e8877ce 100644 --- a/test/functional/vimscript/system_spec.lua +++ b/test/functional/vimscript/system_spec.lua @@ -210,8 +210,8 @@ describe('system()', function() end) it('prints verbose information', function() - nvim('set_option', 'shell', 'fake_shell') - nvim('set_option', 'shellcmdflag', 'cmdflag') + nvim('set_option_value', 'shell', 'fake_shell', {}) + nvim('set_option_value', 'shellcmdflag', 'cmdflag', {}) screen:try_resize(72, 14) feed(':4verbose echo system("echo hi")') -- cgit From f859d16aea0d58e572edc9aaf1de3542569e10a9 Mon Sep 17 00:00:00 2001 From: Sergey Slipchenko Date: Mon, 11 Sep 2023 21:01:00 +0400 Subject: fix(tests): set SHELL=sh #24941 Problem: Some tests fail with $SHELL=fish #6172 Related: https://github.com/neovim/neovim/pull/6176 Solution: Replace "echo -n" with "printf", because "echo" in sh may be provided as a shell builtin, which does not accept an "-n" flag to avoid a trailing newline (e.g. on macos). "printf" is more portable (defined by POSIX) and it does not output a trailing newline by itself. Fixes #6172 TODO: Other test failures may be related to "session leader" issue: https://github.com/neovim/neovim/issues/2354 Checked by running `:terminal ./build/bin/tty-test` from Nvim with `shell=/bin/fish` (inherited from `$SHELL`) and it indeed complains about "process does not own the terminal". With `shell=sh` it doesn't complain. And unsetting `$SHELL` seems to make `nvim` to fall back to `shell=sh`. FAILED test/functional/terminal/tui_spec.lua @ 1017: TUI paste: terminal mode test/functional/terminal/tui_spec.lua:1024: Row 1 did not match. Expected: |*tty ready | |*{1: } | |* | | | |{5:^^^^^^^ }| |{3:-- TERMINAL --} | |{3:-- TERMINAL --} | Actual: |*process does not own the terminal | |* | |*[Process exited 2]{1: } | | | |{5:^^^^^^^ }| |{3:-- TERMINAL --} | |{3:-- TERMINAL --} | To print the expect() call that would assert the current screen state, use screen:snapshot_util(). In case of non-deterministic failures, use screen:redraw_debug() to show all intermediate screen states. stack traceback: test/functional/ui/screen.lua:622: in function '_wait' test/functional/ui/screen.lua:352: in function 'expect' test/functional/terminal/tui_spec.lua:1024: in function FAILED test/functional/terminal/tui_spec.lua @ 1551: TUI forwards :term palette colors with termguicolors test/functional/terminal/tui_spec.lua:1567: Row 1 did not match. Expected: |*{1:t}ty ready | | | |* | | | |{2:^^^^^^^ }| | | |{3:-- TERMINAL --} | Actual: |*{1:p}rocess does not own the terminal | | | |*[Process exited 2] | | | |{2:^^^^^^^ }| | | |{3:-- TERMINAL --} | To print the expect() call that would assert the current screen state, use screen:snapshot_util(). In case of non-deterministic failures, use screen:redraw_debug() to show all intermediate screen states. stack traceback: test/functional/ui/screen.lua:622: in function '_wait' test/functional/ui/screen.lua:352: in function 'expect' test/functional/terminal/tui_spec.lua:1567: in function --- test/functional/vimscript/system_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/functional/vimscript/system_spec.lua') diff --git a/test/functional/vimscript/system_spec.lua b/test/functional/vimscript/system_spec.lua index 762e8877ce..90aab48d61 100644 --- a/test/functional/vimscript/system_spec.lua +++ b/test/functional/vimscript/system_spec.lua @@ -335,12 +335,12 @@ describe('system()', function() if is_os('win') then eq("echoed\n", eval('system("echo echoed")')) else - eq("echoed", eval('system("echo -n echoed")')) + eq("echoed", eval('system("printf echoed")')) end end) it('to backgrounded command does not crash', function() -- This is indeterminate, just exercise the codepath. May get E5677. - feed_command('call system(has("win32") ? "start /b /wait cmd /c echo echoed" : "echo -n echoed &")') + feed_command('call system(has("win32") ? "start /b /wait cmd /c echo echoed" : "printf echoed &")') local v_errnum = string.match(eval("v:errmsg"), "^E%d*:") if v_errnum then eq("E5677:", v_errnum) -- cgit