patch 7.4.1518
Problem: Channel with disconnected in/out/err is not supported.
Solution: Implement it for Unix.
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim
index fa494d3..0f2b542 100644
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -784,6 +784,58 @@
endtry
endfunc
+func Test_pipe_null()
+ if !has('job')
+ return
+ endif
+ " TODO: implement this for MS-Windows
+ if !has('unix')
+ return
+ endif
+ call ch_log('Test_pipe_null()')
+
+ " We cannot check that no I/O works, we only check that the job starts
+ " properly.
+ let job = job_start(s:python . " test_channel_pipe.py something",
+ \ {'in-io': 'null'})
+ call assert_equal("run", job_status(job))
+ try
+ call assert_equal('something', ch_read(job))
+ finally
+ call job_stop(job)
+ endtry
+
+ let job = job_start(s:python . " test_channel_pipe.py err-out",
+ \ {'out-io': 'null'})
+ call assert_equal("run", job_status(job))
+ try
+ call assert_equal('err-out', ch_read(job, {"part": "err"}))
+ finally
+ call job_stop(job)
+ endtry
+
+ let job = job_start(s:python . " test_channel_pipe.py something",
+ \ {'err-io': 'null'})
+ call assert_equal("run", job_status(job))
+ try
+ call assert_equal('something', ch_read(job))
+ finally
+ call job_stop(job)
+ endtry
+
+ let job = job_start(s:python . " test_channel_pipe.py something",
+ \ {'out-io': 'null', 'err-io': 'out'})
+ call assert_equal("run", job_status(job))
+ call job_stop(job)
+
+ let job = job_start(s:python . " test_channel_pipe.py something",
+ \ {'in-io': 'null', 'out-io': 'null', 'err-io': 'null'})
+ call assert_equal("run", job_status(job))
+ call assert_equal('channel fail', string(job_getchannel(job)))
+ call assert_equal('fail', ch_status(job))
+ call job_stop(job)
+endfunc
+
""""""""""
let s:unletResponse = ''
diff --git a/src/testdir/test_channel_pipe.py b/src/testdir/test_channel_pipe.py
index d5da687..fa1a40f 100644
--- a/src/testdir/test_channel_pipe.py
+++ b/src/testdir/test_channel_pipe.py
@@ -10,7 +10,12 @@
if __name__ == "__main__":
if len(sys.argv) > 1:
- print(sys.argv[1])
+ if sys.argv[1].startswith("err"):
+ print(sys.argv[1], file=sys.stderr)
+ sys.stderr.flush()
+ else:
+ print(sys.argv[1])
+ sys.stdout.flush()
while True:
typed = sys.stdin.readline()