comparison src/testdir/test_channel.vim @ 15766:9d18e8457209 v8.1.0890

patch 8.1.0890: pty allocation wrong if using file for out channel commit https://github.com/vim/vim/commit/593864817a08f9b719a093ef4fd8d4d35132ab86 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 10 22:43:46 2019 +0100 patch 8.1.0890: pty allocation wrong if using file for out channel 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)
author Bram Moolenaar <Bram@vim.org>
date Sun, 10 Feb 2019 22:45:06 +0100
parents 208bf8b36075
children 5b6c3c7feba8
comparison
equal deleted inserted replaced
15765:e4f8d017a0c6 15766:9d18e8457209
2038 call WaitForAssert({-> assert_equal("dead", job_status(job))}) 2038 call WaitForAssert({-> assert_equal("dead", job_status(job))})
2039 let info = job_info(job) 2039 let info = job_info(job)
2040 call assert_equal(-1, info.exitval) 2040 call assert_equal(-1, info.exitval)
2041 call assert_equal("term", info.termsig) 2041 call assert_equal("term", info.termsig)
2042 endfunc 2042 endfunc
2043
2044 func Test_job_tty_in_out()
2045 if !has('job') || !has('unix')
2046 return
2047 endif
2048
2049 call writefile(['test'], 'Xtestin')
2050 let in_opts = [{},
2051 \ {'in_io': 'null'},
2052 \ {'in_io': 'file', 'in_name': 'Xtestin'}]
2053 let out_opts = [{},
2054 \ {'out_io': 'null'},
2055 \ {'out_io': 'file', 'out_name': 'Xtestout'}]
2056 let err_opts = [{},
2057 \ {'err_io': 'null'},
2058 \ {'err_io': 'file', 'err_name': 'Xtesterr'},
2059 \ {'err_io': 'out'}]
2060 let opts = []
2061
2062 for in_opt in in_opts
2063 let x = copy(in_opt)
2064 for out_opt in out_opts
2065 call extend(x, out_opt)
2066 for err_opt in err_opts
2067 call extend(x, err_opt)
2068 let opts += [extend({'pty': 1}, x)]
2069 endfor
2070 endfor
2071 endfor
2072
2073 for opt in opts
2074 let job = job_start('echo', opt)
2075 let info = job_info(job)
2076 let msg = printf('option={"in_io": "%s", "out_io": "%s", "err_io": "%s"}',
2077 \ get(opt, 'in_io', 'tty'),
2078 \ get(opt, 'out_io', 'tty'),
2079 \ get(opt, 'err_io', 'tty'))
2080
2081 if !has_key(opt, 'in_io') || !has_key(opt, 'out_io') || !has_key(opt, 'err_io')
2082 call assert_notequal('', info.tty_in, msg)
2083 else
2084 call assert_equal('', info.tty_in, msg)
2085 endif
2086 call assert_equal(info.tty_in, info.tty_out, msg)
2087
2088 call WaitForAssert({-> assert_equal('dead', job_status(job))})
2089 endfor
2090
2091 call delete('Xtestin')
2092 call delete('Xtestout')
2093 call delete('Xtesterr')
2094 endfunc