File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ impl PopenRef {
148
148
self . process . borrow ( ) . exit_status ( )
149
149
}
150
150
151
- fn wait ( self , args : PopenWaitArgs , vm : & VirtualMachine ) -> PyResult < ( ) > {
151
+ fn wait ( self , args : PopenWaitArgs , vm : & VirtualMachine ) -> PyResult < i64 > {
152
152
let timeout = match args. timeout {
153
153
Some ( timeout) => self
154
154
. process
@@ -157,11 +157,16 @@ impl PopenRef {
157
157
None => self . process . borrow_mut ( ) . wait ( ) . map ( Some ) ,
158
158
}
159
159
. 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 {
161
168
let timeout_expired = vm. try_class ( "_subprocess" , "TimeoutExpired" ) ?;
162
169
Err ( vm. new_exception_msg ( timeout_expired, "Timeout" . to_owned ( ) ) )
163
- } else {
164
- Ok ( ( ) )
165
170
}
166
171
}
167
172
You can’t perform that action at this time.
0 commit comments