Commit Graph

10868 Commits

Author SHA1 Message Date
Justin M. Keyes
142ac021ac job-control: one-shot timer instead of repeating
Before f31c26f1af the timer was used to try SIGTERM *and* SIGKILL, so
a repeating timer was needed.  After f31c26f1af process_stop() sends
SIGTERM immediately, and the timer only sends SIGKILL.

So we don't need a repeating timer.
- Simplifies the logic: don't need to call uv_timer_stop() explicitly.
- Avoids a problem: if process_stop() is called more than once in the
  2-second window, the first on_process_exit() would call
  uv_timer_stop() which stops the timer for all stopped processes.
2018-04-15 18:23:11 +02:00
Justin M. Keyes
8fa0b8051d job-control: mitigate process-kill race
children_kill_cb() is racey. One obvious problem is that
process_close_handles() is *queued* by on_process_exit(), so when
children_kill_cb() is invoked, the dead process might still be in the
`loop->children` list.  If the OS already reclaimed the dead PID, Nvim
may try to SIGKILL it.

Avoid that by checking `proc->status`.

Vim doesn't have this problem because it doesn't attempt to kill
processes that ignored SIGTERM after a timeout.

closes #8269
2018-04-15 18:23:11 +02:00
Justin M. Keyes
c8f409c2f2 loop: remove children_stop_requests
It serves no purpose because process_stop() is already guarded by
`proc->stopped_time`.
2018-04-15 18:23:11 +02:00
Justin M. Keyes
7598e6cf17
Merge #8120 'test: win: prefer cmd.exe' 2018-04-15 18:16:37 +02:00
ZyX
aa5008c1f0 ex_cmds: Simplify do_ascii
Specifically apply constants like enc_utf8 (which are constants *now*) and 
simplify conditions after that. Also some style changes.
2018-04-15 19:01:58 +03:00
ZyX
db7f80302b ex_cmds: Remove #ifdef USE_GUI
`ag` shows that this identifier (`USE_GUI`) is found in exactly one place (zero 
after this commit). So I assume macros is never defined.
2018-04-15 18:52:37 +03:00
ZyX
1df9ac1c03 eval: Fix PVS/V547: skipping is now done using eval0 2018-04-15 18:50:02 +03:00
ZyX
f8d574225b eval: Silence PVS/V547: E882 may be triggered
I failed to deduce why analyzer thinks E882 may not be triggered, though 
conditions for triggering it are strange: it would trigger E882 only in the 
single case “function returned non-number”. Cases “function thrown exception”, 
or “built-in sorter encountered error” will neither yield E882 nor stop 
sort()/uniq().

Note though that searching test code revealed that neither E702 nor E882 are not 
tested anywhere.
2018-04-15 18:45:12 +03:00
geekodour
1e71978cf0 events: VimSuspend, VimResume #8280
closes #3648
ref #5959
2018-04-15 15:05:02 +02:00
Justin M. Keyes
1e7d5e8cdf
Merge #6272 'stdpath()' 2018-04-15 04:09:30 +02:00
Jan Edmund Lazo
5abfa94ed2 test: win: use "start" to test backgrounded job (#8171) 2018-04-15 02:43:18 +02:00
Justin M. Keyes
a7e7f7bd83
Merge #8160 'win: oldtests: prefer cmd.exe' 2018-04-15 02:37:22 +02:00
b-r-o-c-k
ee4e1fd8ec win: Fix reading content from stdin (#8267)
Fixes #6890 by reading from the Windows console input buffer after
stdin has been closed.

Vim defines HAVE_DUP for Windows and does the close-dup dance[1]:

    close(0);
    dup(2);

which always fails, then falls back to reading from the Windows console
input buffer[2].

[1] e7499ddc33/src/fileio.c (L2397-L2398)
[2] e7499ddc33/src/os_win32.c (L1703-L1714)
2018-04-14 21:59:07 +02:00
b-r-o-c-k
387fbcd95c win: Fix reading from stdin
* Reading from stdin on Windows is fixed in the same way as it was in
  #8267.
* The file_read function was returning without filling the
  destination buffer when it was called with a non-blocking file
  descriptor.
2018-04-14 14:21:36 -05:00
b-r-o-c-k
ad999eaa77 Merge branch 'master' into s-dash-stdin 2018-04-14 14:17:51 -05:00
Justin M. Keyes
ef4feab0e7
version: rename "0.2.3" to "0.3.0" (#8268)
0.2.1 was a big release, it should have been renamed to 0.3.0.
0.2.3 also has significant changes, so rename it.
2018-04-13 22:15:52 +02:00
Jan Edmund Lazo
51b9d85bb4 ci/win: redirect stderr to fix mingw build 2018-04-13 13:42:12 -04:00
Jan Edmund Lazo
ad30907814 Revert "ci/win: don't use lastexitcode hack on mingw build"
This reverts commit bc43d2559f.

stderr redirection should make the workaround work for mingw builds.
2018-04-13 13:38:31 -04:00
Jan Edmund Lazo
8e87d89a99 oldtests: win: skip test49
Vim doesn't test it on Windows.
See https://github.com/vim/vim/blob/master/src/testdir/Make_all.mak
2018-04-12 21:11:55 -04:00
John Szakmeister
27e26b10a2 tui: abort on unexpected enum value (#8266)
ref #8261
2018-04-13 01:03:00 +02:00
Justin M. Keyes
1c3a849881
API/nvim_command_output: handle :echon capture (#8265)
ref https://github.com/neovim/python-client/pull/290
2018-04-13 00:49:37 +02:00
Justin M. Keyes
5e18550ddd
Merge #7813 'channels: delay free'
fix #7699
2018-04-13 00:35:50 +02:00
Björn Linse
0865adbbc2 channels: cleanup channel freeing code 2018-04-12 22:33:05 +02:00
Björn Linse
aea079a25d channels: delay free so that libuv can cleanup handles
add test for a crash this caused
2018-04-12 18:22:47 +02:00
Justin M. Keyes
2cbeb7ca56 ui_set_option: pass String.data, not String 2018-04-12 12:58:27 +02:00
John Szakmeister
f44fb5b1a5 build/freebsd: set CMAKE_MAKE_PROGRAM iff "Unix Makefiles" (#8260)
It's only appropriate to set CMAKE_MAKE_PROGRAM to gmake when we're
using the "Unix Makefiles" generator.  On QB, the nodes have Ninja
available and will use it, which means CMAKE_GENERATOR is set to
"Ninja".  Setting CMAKE_MAKE_PROGRAM was forcing the build to use gmake
instead of ninja, which was causing the build failure.
2018-04-12 12:51:38 +02:00
John Szakmeister
d48df146d1 tui: fix uninitialize variable usage (#8261)
This fixes an issue with compiles failing in release mode due to shape
having the possibility of being used uninitialized (since the default
case was missing).
2018-04-12 12:50:01 +02:00
Jan Edmund Lazo
714e0f8bf0 oldtests: win: keep set dir=/
Any user can create a directory on root.
Creating a directory on root allows any user to write files within that directory.

Test_recover_root_dir() passes when run locally as a regular user (not admin).
2018-04-12 02:44:06 -04:00
Jan Edmund Lazo
bc43d2559f ci/win: don't use lastexitcode hack on mingw build
The heck is for MSVC builds to workaround msbuild error detection for cmake.
2018-04-12 02:39:25 -04:00
Jan Edmund Lazo
7c8122f36d win: getftype(symlink) returns 'link'
Vim doesn't detect symlinks correctly so stick with Neovim's behaviour.
2018-04-12 02:28:38 -04:00
Jan Edmund Lazo
49e86cebf0 oldtests: check +iconv for makeencoding
MSVC builds don't include it.
Test utf8 and latin only if +iconv is missing.
2018-04-12 02:27:10 -04:00
Jan Edmund Lazo
4bbe51b79e oldtests: win: help sp?it opens split()
Vim 8 and Neovim 0.2.3 open the same target on Windows.
2018-04-12 02:24:46 -04:00
Jan Edmund Lazo
6245b4873d oldtests: win: shellslash for cdpath,tags,:find 2018-04-12 02:24:29 -04:00
Jan Edmund Lazo
fa0e32fba2 oldtests: win: cmd.exe echo has trailing CR 2018-04-12 02:23:53 -04:00
Jan Edmund Lazo
e3687165a7 oldtests: use expand() to fix pathsep
Fix failing oldtests because of noshellslash.
2018-04-12 02:22:33 -04:00
Jan Edmund Lazo
979569356f ci/win: prefer msys find.exe
runnvim.sh depends on it for file glob patterns.
2018-04-12 02:19:03 -04:00
Jan Edmund Lazo
79a8d905ab oldtests: newstyle: win: reset shell to cmd.exe
Unset $SHELL so that child nvim use cmd.exe as default shell.

Unset $TERM so that child nvim don't segfault with negative exit code.
sh/bash use TERM=cygwin by default if it is unset.
mintty sets TERM to xterm.
2018-04-12 02:18:18 -04:00
Justin M. Keyes
87f4d2592c
test/util: expect_err() (#8257)
other cleanup, ref #8245
2018-04-11 22:07:00 +02:00
Justin M. Keyes
f96d99ad11
Merge #8247 'server: introduce --listen' 2018-04-11 03:29:18 +02:00
Justin M. Keyes
777d34ec37 lint 2018-04-11 02:41:05 +02:00
Justin M. Keyes
704ba4151e server: init v:servername if $NVIM_LISTEN_ADDRESS is invalid
Before this change, if $NVIM_LISTEN_ADDRESS was invalid, v:servername
was left empty.
2018-04-11 02:41:05 +02:00
Justin M. Keyes
507bda1c95 server: introduce --listen, deprecate $NVIM_LISTEN_ADDRESS 2018-04-11 02:41:05 +02:00
Justin M. Keyes
7362ca4430 cleanup: remove main_start_gui() 2018-04-11 01:58:42 +02:00
Justin M. Keyes
9f598e5765 serverstop(): return FALSE for invalid address 2018-04-11 01:58:41 +02:00
Justin M. Keyes
b11b681289 test/util: matches() 2018-04-11 01:58:41 +02:00
Justin M. Keyes
f19db1b9ba remove scripts/run-api-tests.exp
Usage of this script was removed 0c2ec77ae0.
2018-04-11 00:56:36 +02:00
ZyX
6f19b9f4e1 eval: Silence PVS/V614: use of potentially uninitialized pointer
It is hard to say whether it actually is uninitialized, need to go deeper into 
regex code. Probably analyzer did not go that far as regmatch for sure would not 
be initialized up until calling NFA/DFA engine functions, which is to be done by 
pointer.
2018-04-10 01:52:18 +03:00
ZyX
4d1b3bf317 eval: Fix PVS/V560: unneded check for name_len
It is unsigned, zero length would already cause early return and length 1 is 
checked earlier in the same condition.
2018-04-10 01:52:08 +03:00
ZyX
07b67f9eff eval: Fix PVS/V547: ufunc_T is actually an incomplete type 2018-04-10 01:51:52 +03:00
ZyX
536d9a6168 edit: Fix PVS/V560: remove always true/false checks 2018-04-10 01:12:59 +03:00