Mercurial > vim
comparison src/testdir/test_terminal.vim @ 13860:7f892e37b017 v8.0.1801
patch 8.0.1801: MS-Windows: redirecting terminal output does not work
commit https://github.com/vim/vim/commit/f25329cb94e481999e8b08d886cc0f0169e2020c
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 6 21:49:32 2018 +0200
patch 8.0.1801: MS-Windows: redirecting terminal output does not work
Problem: MS-Windows: redirecting terminal output does not work.
Solution: Intercept the text written to the terminal and write it to the
file.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 06 May 2018 22:00:07 +0200 |
parents | 8e583c52eb44 |
children | ea0e6c71ba51 |
comparison
equal
deleted
inserted
replaced
13859:be340a68650d | 13860:7f892e37b017 |
---|---|
673 \ "err_buf": bufnr("%") | 673 \ "err_buf": bufnr("%") |
674 \ })', 'E474:') | 674 \ })', 'E474:') |
675 endfunc | 675 endfunc |
676 | 676 |
677 func Test_terminal_redir_file() | 677 func Test_terminal_redir_file() |
678 " TODO: this should work on MS-Window | 678 let cmd = Get_cat_123_cmd() |
679 if has('unix') | 679 let buf = term_start(cmd, {'out_io': 'file', 'out_name': 'Xfile'}) |
680 let cmd = Get_cat_123_cmd() | 680 call term_wait(buf) |
681 let buf = term_start(cmd, {'out_io': 'file', 'out_name': 'Xfile'}) | 681 call WaitForAssert({-> assert_notequal(0, len(readfile("Xfile")))}) |
682 call term_wait(buf) | 682 call assert_match('123', readfile('Xfile')[0]) |
683 call WaitForAssert({-> assert_notequal(0, len(readfile("Xfile")))}) | 683 let g:job = term_getjob(buf) |
684 call assert_match('123', readfile('Xfile')[0]) | 684 call WaitForAssert({-> assert_equal("dead", job_status(g:job))}) |
685 let g:job = term_getjob(buf) | 685 call delete('Xfile') |
686 call WaitForAssert({-> assert_equal("dead", job_status(g:job))}) | 686 bwipe |
687 call delete('Xfile') | |
688 bwipe | |
689 endif | |
690 | 687 |
691 if has('unix') | 688 if has('unix') |
692 call writefile(['one line'], 'Xfile') | 689 call writefile(['one line'], 'Xfile') |
693 let buf = term_start('cat', {'in_io': 'file', 'in_name': 'Xfile'}) | 690 let buf = term_start('cat', {'in_io': 'file', 'in_name': 'Xfile'}) |
694 call term_wait(buf) | 691 call term_wait(buf) |