patch 8.1.0889: MS-Windows: a channel write may hang

Problem:    MS-Windows: a channel write may hang.
Solution:   Check for WriteFile() not writing anything. (Yasuhiro Matsumoto,
            closes #3920)
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim
index 2aef3e1..becd548 100644
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -2003,6 +2003,20 @@
   endtry
 endfunc
 
+func Test_no_hang_windows()
+  if !has('job') || !has('win32')
+    return
+  endif
+
+  try
+    let job = job_start(s:python . " test_channel_pipe.py busy",
+          \ {'mode': 'raw', 'drop': 'never', 'noblock': 0})
+    call assert_fails('call ch_sendraw(job, repeat("X", 80000))', 'E631:')
+  finally
+    call job_stop(job)
+  endtry
+endfunc
+
 func Test_job_exitval_and_termsig()
   if !has('unix')
     return
diff --git a/src/testdir/test_channel_pipe.py b/src/testdir/test_channel_pipe.py
index 810a8e3..5caffcb 100644
--- a/src/testdir/test_channel_pipe.py
+++ b/src/testdir/test_channel_pipe.py
@@ -18,6 +18,9 @@
             print(sys.argv[1], end='')
             sys.stdout.flush()
             sys.exit(0)
+        elif sys.argv[1].startswith("busy"):
+            time.sleep(100)
+            sys.exit(0)
         else:
             print(sys.argv[1])
             sys.stdout.flush()