1212
1313from lib .core .compat import buffer
1414from lib .core .settings import IS_WIN
15+ from thirdparty import six
1516
1617if IS_WIN :
1718 try :
@@ -97,7 +98,7 @@ def send(self, input):
9798 except ValueError :
9899 return self ._close ('stdin' )
99100 except (subprocess .pywintypes .error , Exception ) as ex :
100- if ex [0 ] in (109 , errno .ESHUTDOWN ):
101+ if ( ex [0 ] if six . PY2 else ex . errno ) in (109 , errno .ESHUTDOWN ):
101102 return self ._close ('stdin' )
102103 raise
103104
@@ -118,7 +119,7 @@ def _recv(self, which, maxsize):
118119 except (ValueError , NameError ):
119120 return self ._close (which )
120121 except (subprocess .pywintypes .error , Exception ) as ex :
121- if ex [0 ] in (109 , errno .ESHUTDOWN ):
122+ if ( ex [0 ] if six . PY2 else ex . errno ) in (109 , errno .ESHUTDOWN ):
122123 return self ._close (which )
123124 raise
124125
@@ -136,7 +137,7 @@ def send(self, input):
136137 try :
137138 written = os .write (self .stdin .fileno (), input )
138139 except OSError as ex :
139- if ex [0 ] == errno .EPIPE : # broken pipe
140+ if ( ex [0 ] if six . PY2 else ex . errno ) == errno .EPIPE : # broken pipe
140141 return self ._close ('stdin' )
141142 raise
142143
0 commit comments