@@ -88,13 +88,13 @@ fn (mut p Process) win_spawn_process() int {
8888 sa.n_length = sizeof (C.SECURITY_ATTRIBUTES)
8989 sa.b_inherit_handle = true
9090 create_pipe_ok1 := C.CreatePipe (voidptr (& wdata.child_stdout_read), voidptr (& wdata.child_stdout_write),
91- voidptr (& sa), 0 )
91+ voidptr (& sa), 65536 )
9292 failed_cfn_report_error (create_pipe_ok1 , 'CreatePipe stdout' )
9393 set_handle_info_ok1 := C.SetHandleInformation (wdata.child_stdout_read, C.HANDLE_FLAG_INHERIT,
9494 0 )
9595 failed_cfn_report_error (set_handle_info_ok1 , 'SetHandleInformation' )
9696 create_pipe_ok2 := C.CreatePipe (voidptr (& wdata.child_stderr_read), voidptr (& wdata.child_stderr_write),
97- voidptr (& sa), 0 )
97+ voidptr (& sa), 65536 )
9898 failed_cfn_report_error (create_pipe_ok2 , 'CreatePipe stderr' )
9999 set_handle_info_ok2 := C.SetHandleInformation (wdata.child_stderr_read, C.HANDLE_FLAG_INHERIT,
100100 0 )
@@ -233,6 +233,28 @@ fn (mut p Process) win_read_string(idx int, _maxbytes int) (string, int) {
233233 return buf[..bytes_read].bytestr (), bytes_read
234234}
235235
236+ fn (mut p Process) win_is_pending (idx int ) bool {
237+ mut wdata := unsafe { & WProcess (p.wdata) }
238+ if unsafe { wdata == 0 } {
239+ return false
240+ }
241+ mut rhandle := & u32 (0 )
242+ if idx == 1 {
243+ rhandle = wdata.child_stdout_read
244+ }
245+ if idx == 2 {
246+ rhandle = wdata.child_stderr_read
247+ }
248+ if rhandle == 0 {
249+ return false
250+ }
251+ mut bytes_avail := int (0 )
252+ if C.PeekNamedPipe (rhandle, 0 , 0 , 0 , & bytes_avail, 0 ) {
253+ return bytes_avail > 0
254+ }
255+ return false
256+ }
257+
236258fn (mut p Process) win_slurp (idx int ) string {
237259 mut wdata := unsafe { & WProcess (p.wdata) }
238260 if unsafe { wdata == 0 } {
0 commit comments