diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-02-10 22:43:46 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-02-10 22:43:46 +0100 |
commit | 593864817a08f9b719a093ef4fd8d4d35132ab86 (patch) | |
tree | 03f050e9a044d96c89545d114fd7f455fb6c3aff /src/testdir/test_channel.vim | |
parent | 6524068ff3252f1373807f1ebfde21408cef624e (diff) |
patch 8.1.0890: pty allocation wrong if using file for out channelv8.1.0890
Problem: Pty allocation wrong if using file for out channel and using null
for in channel and null for error channel.
Solution: Correct using use_file_for_out in condition. (Ozaki Kiichi, closes
#3917)
Diffstat (limited to 'src/testdir/test_channel.vim')
-rw-r--r-- | src/testdir/test_channel.vim | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim index becd5484f9..e263115392 100644 --- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -2040,3 +2040,55 @@ func Test_job_exitval_and_termsig() call assert_equal(-1, info.exitval) call assert_equal("term", info.termsig) endfunc + +func Test_job_tty_in_out() + if !has('job') || !has('unix') + return + endif + + call writefile(['test'], 'Xtestin') + let in_opts = [{}, + \ {'in_io': 'null'}, + \ {'in_io': 'file', 'in_name': 'Xtestin'}] + let out_opts = [{}, + \ {'out_io': 'null'}, + \ {'out_io': 'file', 'out_name': 'Xtestout'}] + let err_opts = [{}, + \ {'err_io': 'null'}, + \ {'err_io': 'file', 'err_name': 'Xtesterr'}, + \ {'err_io': 'out'}] + let opts = [] + + for in_opt in in_opts + let x = copy(in_opt) + for out_opt in out_opts + call extend(x, out_opt) + for err_opt in err_opts + call extend(x, err_opt) + let opts += [extend({'pty': 1}, x)] + endfor + endfor + endfor + + for opt in opts + let job = job_start('echo', opt) + let info = job_info(job) + let msg = printf('option={"in_io": "%s", "out_io": "%s", "err_io": "%s"}', + \ get(opt, 'in_io', 'tty'), + \ get(opt, 'out_io', 'tty'), + \ get(opt, 'err_io', 'tty')) + + if !has_key(opt, 'in_io') || !has_key(opt, 'out_io') || !has_key(opt, 'err_io') + call assert_notequal('', info.tty_in, msg) + else + call assert_equal('', info.tty_in, msg) + endif + call assert_equal(info.tty_in, info.tty_out, msg) + + call WaitForAssert({-> assert_equal('dead', job_status(job))}) + endfor + + call delete('Xtestin') + call delete('Xtestout') + call delete('Xtesterr') +endfunc |