-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
startup: Make "-s -" read from stdin #6299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
test/functional/core/main_spec.lua
Outdated
end | ||
neq(0, max_sec) | ||
end) | ||
it('does not expand $VAR', function() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is there because -S
is not working well with such names (-S arg
uses a concat of source
and arg
without any escaping used). -s
is treated different and does not have the problem, but this option looks similar to -S
.
Check whether `repeated_read_cmd` returned nil and did not actually run nvim or it did, but still returned nil for whatever reason.
With nvim: /home/oni-link/git/neovim/.deps/build/src/libuv/src/unix/core.c:521: uv__close: Assertion `fd > STDERR_FILENO' failed.
Aborted |
@oni-link Interesting, I can reproduce this in tmux. I can’t reproduce it when running in Neovim terminal with exactly the same arguments ( Solution is obvious currently: use |
A bit different: I can reproduce this in |
This variant uses `fdopen()` which is not standard, but it fixes problem on my system. In next commit `scriptin` will use `FileDescriptor*` from os/fileio in place of `FILE*`.
Problem: as fileio is cached and reads blocks this is going to wait until either EOF or reading enough characters to fill rbuffer. This is not good when reading user input from stdin as script.
Windows build hangs, |
local attrs = lfs.attributes(fname) | ||
eq(#('100500\n'), attrs.size) | ||
end) | ||
it('does not crash after reading from stdin in non-headless mode', function() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add
if helpers.pending_win32(pending) then return end
here, since this test uses termopen().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
termopen() works on Windows now, so the above comment is outdated. Though reading from stdin on Windows may be broken (#6890) so maybe it's expedient to skip it for now.
It hangs on the very first test, and that does not use |
Assume something with system() if second test hangs as well. Assume something with reading stdin if not.
Code imported from neovim#6299
Code imported from neovim#6299
src/nvim/os/fileio.c
Outdated
/// @param[in] fd File descriptor to wrap. | ||
/// @param[in] flags Flags, @see FileOpenFlags. Currently reading from and | ||
/// writing to the file at once is not supported, so either | ||
/// FILE_WRITE_ONLY or FILE_READ_ONLY is required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be:
kFileWriteOnly or kFileReadOnly is required.
@@ -32,6 +33,8 @@ typedef enum { | |||
///< kFileCreateOnly. | |||
kFileAppend = 64, ///< Append to the file. Implies kFileWriteOnly. Cannot | |||
///< be used with kFileCreateOnly. | |||
kFileNonBlocking = 128, ///< Do not restart read() or write() syscall if | |||
///< EAGAIN was encountered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"EAGAIN or EINTR" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EAGAIN only.
Looks like
hang again. |
If I recall correctly that is “using |
Is it a regression or is it just a new test that can be skipped for now? |
It is a new test, but I am not aware of the similar test that checked something before . BTW, is there some script to build Neovim for wine? E.g. like I did for Vim once: https://bitbucket.org/ZyX_I/vim-dev-tools/src/342d10f67bbbb072288b80d0c7effb2507efe21b/winesetup.pl?at=default prepares WINEPREFIX (also builds Vim), specifically build.zsh near that uses mingw to build vim. |
Not that I know. |
I started working on that, but soon found luarocks/luarocks#749. Most likely that means that quick “just make luarocks compile things for me” is out and all needed packages would be cross-compiled, or alternatives (like lullpeg) found, though I will try to determine why
fails, but succeeds without one pair of quotes. Reported two bugs to wine as a result: https://bugs.winehq.org/show_bug.cgi?id=44133 and https://bugs.winehq.org/show_bug.cgi?id=44132. |
Is the following the intended command? > "C:\luarocks\tools\mkdir\\" -p "abc" Invoking cmd.exe (without explicit escaping) should be cmd.exe /s/c ""C:\luarocks\tools\mkdir\\" -p "abc"" Seems to be a bug in os.execute if it's using |
@ZyX-I If you have a RDP client you can connect to appveyor for 1-2 hours, useful for sanity checks. Requires a temporary change to appveyor.yml, a bit annoying but it works well. https://www.appveyor.com/docs/how-to/rdp-to-build-worker/ |
After ignoring the "does not expand $VAR" test in #7713 now the "old tests" hang (since #7705 , the Vim "old tests" run on AppVeyor). This hangs:
So there is a regression in the behavior of |
mch_errmsg("\"\n"); | ||
int error; | ||
if (STRCMP(argv[0], "-") == 0) { | ||
const int stdin_dup_fd = os_dup(OS_STDIN_FILENO); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end | ||
end | ||
|
||
describe('Command-line option', function() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could go in startup_spec.lua
No description provided.