File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -162,19 +162,22 @@ pub(crate) mod module {
162162
163163 #[ cfg( target_env = "msvc" ) ]
164164 #[ pyfunction]
165- fn waitpid ( pid : intptr_t , opt : i32 , vm : & VirtualMachine ) -> PyResult < ( intptr_t , i32 ) > {
166- let mut status = 0 ;
165+ fn waitpid ( pid : intptr_t , opt : i32 , vm : & VirtualMachine ) -> PyResult < ( intptr_t , u64 ) > {
166+ let mut status: i32 = 0 ;
167167 let pid = unsafe { suppress_iph ! ( _cwait( & mut status, pid, opt) ) } ;
168168 if pid == -1 {
169169 Err ( errno_err ( vm) )
170170 } else {
171- Ok ( ( pid, status << 8 ) )
171+ // Cast to unsigned to handle large exit codes (like 0xC000013A)
172+ // then shift left by 8 to match POSIX waitpid format
173+ let ustatus = ( status as u32 ) as u64 ;
174+ Ok ( ( pid, ustatus << 8 ) )
172175 }
173176 }
174177
175178 #[ cfg( target_env = "msvc" ) ]
176179 #[ pyfunction]
177- fn wait ( vm : & VirtualMachine ) -> PyResult < ( intptr_t , i32 ) > {
180+ fn wait ( vm : & VirtualMachine ) -> PyResult < ( intptr_t , u64 ) > {
178181 waitpid ( -1 , 0 , vm)
179182 }
180183
You can’t perform that action at this time.
0 commit comments