patch 8.0.1074: ":term NONE" does not work on MS-Windows
Problem: ":term NONE" does not work on MS-Windows.
Solution: Make it work. Split "pty" into "pty_in" and "pty_out". (Yasuhiro
Matsumoto, closes #2058, closes #2045)
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 8005679..efc491d 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -36,11 +36,11 @@
func Test_terminal_basic()
let buf = Run_shell_in_terminal({})
if has("unix")
- call assert_match("^/dev/", job_info(g:job).tty)
- call assert_match("^/dev/", term_gettty(''))
+ call assert_match('^/dev/', job_info(g:job).tty_out)
+ call assert_match('^/dev/', term_gettty(''))
else
- call assert_match("^winpty://", job_info(g:job).tty)
- call assert_match("^winpty://", term_gettty(''))
+ call assert_match('^\\\\.\\pipe\\', job_info(g:job).tty_out)
+ call assert_match('^\\\\.\\pipe\\', term_gettty(''))
endif
call assert_equal('t', mode())
call assert_match('%aR[^\n]*running]', execute('ls'))
@@ -539,10 +539,6 @@
endfunc
func Test_terminal_no_cmd()
- " Todo: make this work on all systems.
- if !has('unix')
- return
- endif
" Todo: make this work in the GUI
if !has('gui_running')
return
@@ -550,11 +546,20 @@
let buf = term_start('NONE', {})
call assert_notequal(0, buf)
- let pty = job_info(term_getjob(buf))['tty']
+ let pty = job_info(term_getjob(buf))['tty_out']
call assert_notequal('', pty)
- call system('echo "look here" > ' . pty)
+ if has('win32')
+ silent exe '!cmd /c "echo look here > ' . pty . '"'
+ else
+ call system('echo "look here" > ' . pty)
+ endif
call term_wait(buf)
- call assert_equal('look here', term_getline(buf, 1))
+
+ let result = term_getline(buf, 1)
+ if has('win32')
+ let result = substitute(result, '\s\+$', '', '')
+ endif
+ call assert_equal('look here', result)
bwipe!
endfunc
@@ -600,6 +605,7 @@
call WaitFor('len(readfile("Xfile")) > 0')
call assert_match('123', readfile('Xfile')[0])
call delete('Xfile')
+ bwipe
endif
if has('unix')
@@ -608,6 +614,7 @@
call WaitFor('len(readfile("Xfile")) > 0')
call assert_match('executing job failed', readfile('Xfile')[0])
call delete('Xfile')
+ bwipe
call writefile(['one line'], 'Xfile')
let buf = term_start('cat', {'in_io': 'file', 'in_name': 'Xfile'})