Commit Graph

16 Commits

Author SHA1 Message Date
Gregory Anders
50b30de200
feat(terminal): TermClose: set exit code in v:event.status #15406
Closes #4713
2021-08-20 10:45:28 -07:00
Justin M. Keyes
605f05f635 test: shell-test.c: flush all streams 2019-09-01 22:49:33 -07:00
Daniel Hahler
bf85023005 shell-test: remove REP_NODELAY, less delay with REP
REP_NODELAY was added because REP delayed too much.  This changes REP to
only add a delay on every 100th line instead.

This helps to cover the additional pulse steps with
out_data_decide_throttle, which would have required to change
REP_NODELAY anyway.
2019-08-30 07:12:46 +02:00
Daniel Hahler
38a3af5dff
tests: output_spec: use shell-test REP_NODELAY (#10726)
Fix flaky "shell command :! throttles shell-command output greater than ~10KB:":

    [ RUN      ] shell command :! throttles shell-command output greater than ~10KB:
    warning: Screen changes were received after the expected state. This indicates
    indeterminism in the test. Try adding screen:expect(...) (or wait()) between
    asynchronous (feed(), nvim_input()) and synchronous API calls.
      - Use screen:redraw_debug() to investigate; it may find relevant intermediate
        states that should be added to the test to make it more robust.
      - If the purpose of the test is to assert state after some user input sent
        with feed(), adding screen:expect() before the feed() will help to ensure
        the input is sent when Nvim is in a predictable state. This is preferable
        to wait(), for being closer to real user interaction.
      - wait() can trigger redraws and consequently generate more indeterminism.
        Try removing wait().

    ERR
    test/functional/ui/screen.lua:579: Failed to match any screen lines.
    Expected (anywhere): "
    %."
    Actual:
      |XXXXXXXXXX 591                                    |
      |XXXXXXXXXX 592                                    |
      |XXXXXXXXXX 593                                    |
      |XXXXXXXXXX 594                                    |
      |                                                  |
      |                                                  |
      |{3:-- TERMINAL --}                                    |
    stack traceback:
            test/functional/ui/screen.lua:579: in function '_wait'
            test/functional/ui/screen.lua:367: in function 'expect'
            test/functional/ui/output_spec.lua:63: in function <test/functional/ui/output_spec.lua:53>

Log: https://travis-ci.org/neovim/neovim/jobs/569082705#L5355
(gcc-functionaltest-lua)
2019-08-08 16:02:28 +02:00
Daniel Hahler
d7274f2417
shell-test: fix REP for count larger than uint8_t (#10581) 2019-07-22 20:49:45 +02:00
Justin M. Keyes
b764120ee7
test: shell-test.c: "REP" command: flush, wait 1ms #10552
Typically most shell output is the result of non-trivial work, so it
would not blast stdout instantaneously.  To more closely simulate that
typical scenario, change `shell-test REP` to wait 1 millisecond between
iterations.
2019-07-20 18:07:04 +02:00
Justin M. Keyes
643ba06d4d
test: shell-test.c: flush stdout for REP #10548
fix #10534
2019-07-20 12:52:33 +02:00
Daniel Hahler
3a1d3e9ef1
tests: shell-test: use count for REP (#10514)
Also fix V576: use width specification

> Incorrect format. Consider checking the third actual argument of the
> 'sscanf' function. It's dangerous to use string specifier without width
> specification. Buffer overflow is possible.
2019-07-16 21:35:53 +02:00
Daniel Hahler
f6298aba82
tests: shell-test: add INTERACT mode (#10405)
Use it to improve ls_spec: it should not use the user's real shell for
performance and other reasons.
2019-07-03 22:49:13 +02:00
b-r-o-c-k
c29a82c45f build/msvc: Make shell-test fix only apply to MSCV 2018-03-06 20:38:10 -06:00
b-r-o-c-k
773f23e00d build/msvc: Make shell-test work
MSVC doesn't have unistd.h or usleep() so it was replaced with the
Sleep() WinAPI function.
2018-03-04 17:44:23 -06:00
Björn Linse
f75c4b39ec shell: handle split-up UTF-8 sequences 2018-02-10 22:28:12 +01:00
ZyX
c2f3e361c5 *: Add comment to all C files 2017-04-19 19:11:50 +03:00
Jack Bracewell
2ea7bfc627 terminal: Support extra arguments in 'shell'. #4504
Tokenize p_sh if used as default in ex_terminal(). Previously p_sh was
used as the first arg in a list when calling termopen(), this would try
to call an untokenized version of shell, meaning if you had an argument
in 'shell':
    set shell=/bin/bash\ --login
the command would fail.

Helped-by: oni-link <knil.ino@gmail.com>

Closes #3999
2017-03-17 17:47:33 +01:00
ZyX
712f057ed9 functests: Make sure that setting scrollback size works from TermOpen 2016-02-28 07:34:36 +03:00
Scott Prager
74aef89720 term: use an argument vector for termopen().
Old behaviour: termopen('cmd') would run `&shell &shcf "cmd"`, which
caused the functional tests to fail on some systems due to the process
not "owning" the terminal. Also, it is inconsistent with jobstart().

Modify termopen() so that &shell is not invoked, but maintain the old
behaviour with :terminal. Factor the common code for building the
argument vector from jobstart() and modify the functional tests to call
termopen() instead of :terminal (fixes #2354).

Also:
 * Add a 'name' option for termopen() so that `:terminal {cmd}` produces
   a buffer named "term//{cwd}/{cmd}" and termopen() users can customize
   the name.
 * Update the documentation.
 * Add functional tests for `:terminal` sinse its behaviour now differs
   from termopen(). Add "test/functional/fixtures/shell-test.c" and move
   "test/functional/job/tty-test.c" there, too.

Helped-by: Justin M. Keyes <@justinmk>
2015-05-02 09:47:29 -04:00