Commit Graph

112 Commits

Author SHA1 Message Date
Daniel Hahler
41bb68b8e8 process_stop: uv: do not close stdin first/explicitly #10584
- process_stop: do not close stdin explicitly. The "close stdin" step was from
  aa9cb48, before we fixed/reworked the SIGTERM timing logic. So it's probably
  outdated / no longer needed.
- win: jobstop: exit_code 15
   GetExitCodeProcess appears to return the used signal.
   https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getexitcodeprocess

ref #10573
2019-08-01 13:55:06 +02:00
Daniel Hahler
6e01ed6a4c vim-patch:8.1.0572: stopping a job does not work properly on OpenBSD
Problem:    Stopping a job does not work properly on OpenBSD.
Solution:   Do not use getpgid() to check the process group of the job
            processs ID, always pass the negative process ID to kill().
            (George Koehler, closes vim/vim#3656)
76ab4fd619

Ref: https://github.com/neovim/neovim/issues/9704
Ref: https://github.com/neovim/neovim/issues/10182#issuecomment-514450069
Closes https://github.com/neovim/neovim/pull/10660
2019-07-30 18:41:38 +02:00
Daniel Hahler
2906c702f9 tests: use "cat" also on Windows
Fixes https://github.com/neovim/neovim/issues/10574.

Keeps 'can be called recursively' pending for now, see
https://github.com/neovim/neovim/pull/10580#issuecomment-515295571.
2019-07-26 21:45:00 +02:00
Justin M. Keyes
bb3a0099c6 os/fs: introduce os_fopen()
Windows: Using fopen() directly may need UTF-16 filepath conversion. To
achieve that, os_fopen() goes through os_open().

fix #10586
2019-07-25 22:32:23 +02:00
Björn Linse
d4938743e6 channel: refactor events, prevent recursive invocation of events 2019-06-18 10:49:38 +02:00
Daniel Hahler
6f27f5ef91 main: do event_init before early_init #10183
Fixes https://github.com/neovim/neovim/issues/10172

* move log_init to event_init
* move init_signs to end of early_init
2019-06-12 14:22:42 +02:00
erw7
89c2747eed Fix issue where test fails 2019-06-04 08:49:27 +09:00
Justin M. Keyes
7cc01c704c Merge #9709 'fileio: use os_copy to create backups'
ref #8288
2019-05-20 22:33:19 +02:00
Justin M. Keyes
fd04877eb0 test: remove use of require('test.helpers')
The test.functional.helpers and test.unit.helpers modules now include
all of the public functions from test.helpers, so there is no need to
separately require('test.helpers').
2019-05-18 15:48:13 +02:00
Justin M. Keyes
24f9dd73d5 test/channels_spec: cleanup
- Remove stray print()
- Use uname() instead of system('uname')
2019-05-12 00:43:28 +02:00
Justin M. Keyes
4b65a0059a test: cleanup
Avoid hyper-granularity. Don't need subdirectories for every little
thing.
2019-05-05 23:01:35 +02:00
Justin M. Keyes
fd0fd752c8 terminal: swap priority of terminal, editor highlights
closes #9964
2019-05-02 09:56:22 +02:00
Justin M. Keyes
17291642bd test: clear(): args_rm parameter 2019-04-27 16:19:40 +02:00
Justin M. Keyes
ddd0eb6f51
startup: -es/-Es (silent/batch mode): skip swapfile #8540
To use Nvim as a scripting engine the side-effects of swapfiles and user
config should be avoided by default.
2019-04-10 03:27:25 +02:00
Said Al Attrach
2bf18e7843
test: move trim to global helpers 2019-03-30 18:14:20 +01:00
Said Al Attrach
a9df3fa5d2
test: make first attempt at some kind of test 2019-03-24 00:21:26 +01:00
James McCoy
314f6ea367
startup: Use $XDG_CONFIG_DIRS/nvim/sysinit.vim if it exists
Closes #8994
2018-12-16 12:05:47 -05:00
Justin M. Keyes
32a30d90b4
highlight: Fix missing .rgb_sp_color in initializers (#9287)
terminal_get_line_attributes() had this bug for a long time, though it
likely had no effect visible to users.

ref #9028
ref 60f845ca55
2018-11-30 21:13:01 +01:00
Tommy Allen
c4c74c3883 jobstart(): Fix hang on non-executable cwd #9204
* os/fs.c: add os_isdir_executable()
* eval.c: fix hang on job start caused by non-executable cwd option
* channel.c: assert cwd is an executable directory
* test: jobstart() produces error when using non-executable cwd
2018-11-07 10:31:25 +01:00
Justin M. Keyes
f5671c8614 win: test: SIGWINCH is noisy #7506 2018-11-01 17:17:07 +01:00
Jan Edmund Lazo
8e44396794 functionaltest: enable buffered output tests 2018-10-31 22:55:07 -04:00
James McCoy
eb7b2c7912
Fix crash if --embed is used more than once 2018-10-03 07:29:08 -04:00
Justin M. Keyes
51d42917f0 test/win: job_spec: increase jobwait() timeout
powershell is slow, and this timeout is "worst case" so it doesn't make
the tests more costly, only avoids a false-positive.

close #8958
2018-09-05 22:05:05 +02:00
Björn Linse
3d88287e30 tests: introduce screen:expect{...} form 2018-08-27 15:15:49 +02:00
Justin M. Keyes
9625e9da75 startup: delete empty stdin buffer if other files were opened
DWIM: avoid empty buffer 1 when stdin was empty. If other files were
specified at startup, we assume that stdin is only accidentally
not-a-TTY: user did not intend to send text from it.

ref #8560
ref #8561
2018-06-18 21:51:42 +02:00
Justin M. Keyes
d44ed79ccc startup: go to buffer 2 if stdin is empty
If stdin is not a TTY we read it into buffer 1, as text. But if the
stdin pipe is empty, Nvim was most likely invoked for some other reason.
DWIM: select buffer 2 (if it exists). Example:

    echo file1 | xargs nvim

closes #8560
closes #8561
ref https://github.com/equalsraf/neovim-qt/issues/417
2018-06-18 17:51:38 +02:00
Justin M. Keyes
487cf98c0b startup: fix -E/-Es without -u NONE
Before this change, -E/-Es without `-u NONE` reads stdin as Ex commands.
It should always read stdin as text (into buffer 1), like this:

    echo foo | nvim -Es +'%p'
    foo
    echo foo | nvim -Es -u NORC +'%p'
    foo
2018-06-17 14:50:53 +02:00
Justin M. Keyes
9c2099d585 Ex mode: use getexline() instead of getexmodeline()
This changes Ex mode (Q, -e) to work like Vim's "improved Ex mode"
(gQ, -E).  That brings some small behavior differences, but should not
impact most Ex scripts (unless, for example, they depend on mappings
being disabled--but that can be solved for -e by skipping user config).

Before this change:
* the screen test hangs.

After this change:
* Q acts like gQ.
* -e/-es differs from -E/-Es only in its treatment of stdin.

This moves towards potentially removing getexmodeline().
(HINT: That does NOT mean "removing Ex mode", it means removing the
Vi-compatible Ex mode, which differs from Vim's "improved Ex mode" only
in some minor details (e.g. mappings are disabled).)

ref #1089 :-)~
2018-06-17 14:50:53 +02:00
Justin M. Keyes
dc5fdbc758 test: fix startup_spec
This behavior was changed (improved) by 5861dc5966 which actually
makes -E more faithful to Vim's behavior.
2018-06-10 16:27:13 +02:00
Justin M. Keyes
d8c7ff1335 cleanup, test interactive -E 2018-06-04 02:09:28 +02:00
Justin M. Keyes
1f300e08b8 win/startup: remove --literal
Fixes 2 failing tests in startup_spec.lua.

The Windows-only `--literal` option complicates support of "stdin-as-text
+ file-args" (#7679).  Could work around it, but it's not worth
the trouble:
- users have a reasonable (and englightening) alternative: nvim +"n *"
- "always literal" is more consistent/predictable
- avoids platform-specific special-case

Unrelated changes:
- Replace fileno(stdxx) with STDXX_FILENO for consistency (not motivated
  by any observed technical reason).
2018-06-04 02:09:27 +02:00
Justin M. Keyes
4211255c75 startup: allow explicit "-" file arg with --headless 2018-06-04 02:09:27 +02:00
Justin M. Keyes
63058fb5b0 startup: fix -es/-Es so they are actually silent
silent-mode (-es/-Es) has been broken for years.  The workaround up to
now was to include --headless.  But --headless is not equivalent because
it prints all messages, not the limited subset defined by silent-mode.
2018-06-04 02:09:27 +02:00
Justin M. Keyes
51e817dc1b startup: stdin as text instead of commands
Treat stdin as text by default (so the "-" file is not needed):
    echo foo | nvim

It works with file args (implemented in next commit), too:
    echo foo | nvim file1.txt file2.txt

Why? Because:
- Execution of input is (1) almost always unintentional/confusing,
  and (2) potentially destructive.
- Avoids the need for time-delayed warning.  #7659
- The _common_ case is to open text in a buffer, not send commands.

Note:
- Not for Ex-mode (-es) because it is used by scripts.  But maybe `-Es`?
- Not for --headless, because stdio may be a protocol stream and may be
  used for any purpose by stdioopen().

To treat stdin as Normal-mode commands, use `-s -` instead:
    echo ifoo | nvim -s -
Other alternatives:
  - Replay a register. E.g. the following mostly works, except @q aborts
    on any "beep" (e.g. if the cursor can't move).
    nvim -c '%d q|norm @q' -
  - Future: Let `:%source` work with unsaved buffer contents?

closes #2087
closes #7659
2018-06-04 02:07:39 +02:00
Björn Linse
a676c658cc channel: avoid references to non-rooted vimL list with output
likely fixes #7768 #7913

If multiple internal stream callbacks were recieved before vimL
callbacks got called, only invoke one vimL callback with all data.
2018-05-17 19:09:32 +02:00
Justin M. Keyes
77cb14cc6d API: nvim__stats()
Use it to verify fsync() behavior.
2018-04-24 00:44:06 +02:00
Justin M. Keyes
32f3937477 test: fsync() codepaths 2018-04-23 21:29:07 +02:00
Justin M. Keyes
be2a3ddd58
test: "Command-line option -s": avoid indeterminism (#8305)
closes #8303
2018-04-21 03:15:18 +02:00
Justin M. Keyes
7a13611ba2
Merge #8276 'startup: Make -s - read from stdin' 2018-04-17 10:33:36 +02:00
Justin M. Keyes
7598e6cf17
Merge #8120 'test: win: prefer cmd.exe' 2018-04-15 18:16:37 +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
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
Jan Edmund Lazo
51f5cfc16e test: win: enable jobpid() tests
Use ping to test job detach
Use find.exe as an alternative to cat.exe
Use nvim_get_proc to check pid
2018-03-26 01:45:42 -04:00
Jan Edmund Lazo
ad6d577314 fixup: ping.exe works with cmd.exe pipe 2018-03-26 01:45:41 -04:00
Jan Edmund Lazo
e6ee06ee11 Revert "test/win: use cmd.exe for test"
This reverts commit ae409b5042.

This PR (#8120) defaults to cmd.exe for job_spec.lua
2018-03-26 01:45:41 -04:00
Jan Edmund Lazo
03e69a5d9c test: win: use find.exe /v "" as alternative cat - 2018-03-26 01:45:40 -04:00
Jan Edmund Lazo
3bd555f1e6 test: win: try stderr callback and slow output 2018-03-26 01:45:38 -04:00
Jan Edmund Lazo
cf4fbb6f04 test: win: use powershell for Start-Sleep only
cmd.exe (shell) is faster and more reliable than powershell (.NET frontend).
It's best for short and basic tests that don't require non-trivial scripting.
cmd.exe doesn't support sleep so use powershell's Start-Sleep as substitute.
2018-03-26 01:45:37 -04:00
Nimit Bhardwaj
8d64a2fb1d test: lua test for vim-patch:8.0.0184
2b7bc567b9
2018-03-24 23:06:09 +01:00