@@ -386,9 +386,6 @@ DEF _CALL_PIPE_CONNECTION_LOST = 1
386386DEF _CALL_PROCESS_EXITED = 2
387387DEF _CALL_CONNECTION_LOST = 3
388388
389- cdef int WINDOWS_EXE_FROZEN = system.__IS_WINDOWS_EXE_FROZEN()
390-
391-
392389
393390@cython.no_gc_clear
394391cdef class UVProcessTransport(UVProcess):
@@ -445,11 +442,6 @@ cdef class UVProcessTransport(UVProcess):
445442
446443
447444 cdef _file_redirect_stdio(self , int fd):
448- if WINDOWS_EXE_FROZEN:
449- # SEE: https://github.com/Vizonex/Winloop/issues/126
450- # use devnull instead...
451- return self ._file_devnull()
452-
453445 fd = os_dup(fd)
454446 os_set_inheritable(fd, True )
455447 self ._close_after_spawn(fd)
@@ -502,6 +494,16 @@ cdef class UVProcessTransport(UVProcess):
502494 ' subprocess.STDOUT is supported only by stderr parameter' )
503495 else :
504496 io[0 ] = self ._file_redirect_stdio(_stdin)
497+
498+ elif system.PLATFORM_IS_WINDOWS and system.__UVLOOP_STDIN_BAD:
499+
500+ # When a stdio is in a gui-like state without a console.
501+ # using a standard redirect is not a good idea. This at least
502+ # is a better workaround that is a bit cleaner than doing what the
503+ # python standard libary subprocess does with the _get_handles function
504+ # on windows. SEE: https://github.com/Vizonex/Winloop/issues/126
505+
506+ io[0 ] = self ._file_devnull()
505507 else :
506508 io[0 ] = self ._file_redirect_stdio(0 )
507509
@@ -530,6 +532,8 @@ cdef class UVProcessTransport(UVProcess):
530532 ' subprocess.STDOUT is supported only by stderr parameter' )
531533 else :
532534 io[1 ] = self ._file_redirect_stdio(_stdout)
535+ elif system.PLATFORM_IS_WINDOWS and system.__UVLOOP_STDOUT_BAD:
536+ io[1 ] = self ._file_devnull()
533537 else :
534538 io[1 ] = self ._file_redirect_stdio(1 )
535539
@@ -555,6 +559,9 @@ cdef class UVProcessTransport(UVProcess):
555559 io[2 ] = self ._file_devnull()
556560 else :
557561 io[2 ] = self ._file_redirect_stdio(_stderr)
562+
563+ elif system.PLATFORM_IS_WINDOWS and system.__UVLOOP_STDOUT_BAD:
564+ io[2 ] = self ._file_devnull()
558565 else :
559566 io[2 ] = self ._file_redirect_stdio(2 )
560567
0 commit comments