File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ impl PopenRef {
148148 self . process . borrow ( ) . exit_status ( )
149149 }
150150
151- fn wait ( self , args : PopenWaitArgs , vm : & VirtualMachine ) -> PyResult < ( ) > {
151+ fn wait ( self , args : PopenWaitArgs , vm : & VirtualMachine ) -> PyResult < i64 > {
152152 let timeout = match args. timeout {
153153 Some ( timeout) => self
154154 . process
@@ -157,11 +157,16 @@ impl PopenRef {
157157 None => self . process . borrow_mut ( ) . wait ( ) . map ( Some ) ,
158158 }
159159 . map_err ( |s| vm. new_os_error ( format ! ( "Could not start program: {}" , s) ) ) ?;
160- if timeout. is_none ( ) {
160+ if let Some ( exit) = timeout {
161+ use subprocess:: ExitStatus :: * ;
162+ Ok ( match exit {
163+ Exited ( i) => i. into ( ) ,
164+ Signaled ( s) => -i64:: from ( s) ,
165+ _ => unreachable ! ( "should not occur in normal operation" ) ,
166+ } )
167+ } else {
161168 let timeout_expired = vm. try_class ( "_subprocess" , "TimeoutExpired" ) ?;
162169 Err ( vm. new_exception_msg ( timeout_expired, "Timeout" . to_owned ( ) ) )
163- } else {
164- Ok ( ( ) )
165170 }
166171 }
167172
You can’t perform that action at this time.
0 commit comments