File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -752,12 +752,13 @@ impl IpcRpc for IpcRpcImpl {
752
752
pipesfin. close ( ) ;
753
753
}
754
754
} ) ;
755
- let pipesfin = pipesctx. clone ( ) ;
756
755
// In any case, we will close all pipes after a certain period of time.
757
756
// This ensures that the function always completes if the ipc script is not written as expected.
757
+ let pipesfin = pipesctx. clone ( ) ;
758
+ let exit = tokio:: sync:: oneshot:: channel ( ) ;
758
759
self . shared . async_handle ( ) . spawn ( {
759
760
async move {
760
- tokio:: time:: sleep ( tokio:: time:: Duration :: from_secs ( 8 ) ) . await ;
761
+ let _ = tokio:: time:: timeout ( tokio:: time:: Duration :: from_secs ( 8 ) , exit . 1 ) . await ;
761
762
pipesfin. close ( ) ;
762
763
}
763
764
} ) ;
@@ -802,6 +803,9 @@ impl IpcRpc for IpcRpcImpl {
802
803
. deref_mut ( ) ,
803
804
)
804
805
. map_err ( |e| RPCError :: custom_with_error ( RPCError :: IPC , e) ) ?;
806
+ exit. 0
807
+ . send ( ( ) )
808
+ . map_err ( |_| RPCError :: custom_with_error ( RPCError :: IPC , "Unexpected" ) ) ?;
805
809
Ok ( IpcResponse {
806
810
version : Uint64 :: from ( resp. version ( ) as u64 ) ,
807
811
error_code : Uint64 :: from ( resp. error_code ( ) ) ,
You can’t perform that action at this time.
0 commit comments